Open
Description
Describe the bug
#2533 (comment)
To Reproduce
- Create
supabase/functions/slug/index.ts
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
import { handler } from "../../../../common/index.ts";
console.log("Hello from Functions!");
Deno.serve(handler);
- Create
../common/index.ts
export const handler = async (req) => {
const { name } = await req.json()
const data = {
message: `Hello ${name}!`,
}
return new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" } },
)
}
- Run
supabase functions deploy --use-api
and observe error
Uploading asset (update): supabase/functions/slug/index.ts
failed to read file: open ../common/index.ts: invalid argument
Try rerunning the command with --debug to troubleshoot the error.
exit status 1
Expected behavior
Deploying functions that import from parent directory should also work.
The current workaround is to use docker deploy.
System information
- Version of OS: macOS
- Version of CLI: v2.22.3
Additional context
Since our bundle API doesn't support parent directories, we have to change the working directory to the actual repo path rather than the current default of ../supabase
. This will be a large refactor but also helps with setting more consistent paths in other places like the seed table.