Skip to content

Unexpected behaviour when importing another project using its mod.ts file #3093

Description

@maximilian-hammerl

Describe the bug

We started using Deno workspaces recently and when we found it that Supabase edge functions do not yet support Deno workspaces (#3047), we worked around this issue by adding the workspace members to the imports like this:

{
  "imports": {
    ...
    "other_workspace_member_name/": "../path/to/workspace/member/",
    ...
  }
}

As the next step we wanted to just import the mod.ts files of the other workspace members:

{
  "imports": {
    ...
    "other_workspace_member_name": "../path/to/workspace/member/mod.ts",
    ...
  }
}

While we refactored our edge functions, we tested every edge functions after we adjusted its imports and everything worked as expected.
But as soon as we refactored the last edge functions, all edge functions always failed with the following error message:

Using supabase-edge-runtime-1.66.5 (compatible with Deno v1.45.2)
serving the request with supabase/functions/import-mod-ts
worker boot error: failed to create the graph: Module not found "file:///.../supabase-local-import-bug/another-project/file_a.ts".
    at file:///.../supabase-local-import-bug/another-project/mod.ts:1:15
worker boot error: failed to create the graph: Module not found "file:///Users/maximilianhammerl/Documents/Repositories/supabase-local-import-bug/another-project/file_a.ts".
    at file:///...supabase-local-import-bug/another-project/mod.ts:1:15
InvalidWorkerCreation: worker boot error: failed to create the graph: Module not found "file:///Users/maximilianhammerl/Documents/Repositories/supabase-local-import-bug/another-project/file_a.ts".
    at file:///.../supabase-local-import-bug/another-project/mod.ts:1:15
    at async UserWorker.create (ext:sb_user_workers/user_workers.js:139:15)
    at async Object.handler (file:///root/index.ts:157:22)
    at async respond (ext:sb_core_main_js/js/http.js:197:14) {
  name: "InvalidWorkerCreation"

To Reproduce

Repository with more details, examples and to how to reproduce: https://github.com/maximilian-hammerl/supabase-local-import-bug

Expected behavior

Imports of one edge functions should not affect other edge functions in any way.


I was not sure whether to open this issue here in the CLI repository or in the edge runtime repository. I decided for the CLI repository, as we use the edge runtime through the CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions