Skip to content

Custom path mapping for dependencies with deno.json seems to be broken #2846

Closed

Description

@SanjoSolutions

Describe the bug
The custom path mapping for dependencies with deno.json as described in the documentation seems to be broken.

It works with the legacy import maps method.

System information

  • Version of OS: Windows 11
  • Version of CLI: 1.215.0

I hope the information is sufficient to reproduce it.

Activity

  1. sweatybridge commented on Nov 7, 2024

    @sweatybridge
    Contributor

    Hi @SanjoSolutions, thanks for reporting this issue. Are you perhaps using relative path imports in deno.json? Could you give us a minimal reproducible example to illustrate what's broken?

  2. SanjoSolutions commented on Nov 7, 2024

    @SanjoSolutions
    Author

    Are you perhaps using relative path imports in deno.json?

    Yes.

    In my case the content is:

    {
      "imports": {
        "basejump/": "../../../../basejump-deno-packages/"
      }
    }

    With the legacy import maps this works.
    With the deno.json method with an import like import { billingFunctionsWrapper, stripeFunctionHandler, } from "basejump/billing-functions/mod.ts"; I receive the following error:

    $ npx supabase functions serve
    Setting up Edge Functions runtime...
    Serving functions on http://127.0.0.1:54321/functions/v1/<function-name>
    Using supabase-edge-runtime-1.60.1 (compatible with Deno v1.45.2)
    serving the request with supabase/functions/billing-functions
    worker boot error: failed to create the graph: Relative import path "basejump/billing-functions/mod.ts" not prefixed with / or ./ or ../
        at file:///Users/jonas/saas-template/supabase/functions/billing-functions/index.ts:5:8
    worker boot error: failed to create the graph: Relative import path "basejump/billing-functions/mod.ts" not prefixed with / or ./ or ../
        at file:///Users/jonas/saas-template/supabase/functions/billing-functions/index.ts:5:8
    InvalidWorkerCreation: worker boot error: failed to create the graph: Relative import path "basejump/billing-functions/mod.ts" not prefixed with / or ./ or ../
        at file:///Users/jonas/saas-template/supabase/functions/billing-functions/index.ts:5:8
        at async UserWorker.create (ext:sb_user_workers/user_workers.js:145:15)
        at async Object.handler (file:///root/index.ts:156:22)
        at async respond (ext:sb_core_main_js/js/http.js:163:14) {
      name: "InvalidWorkerCreation"
  3. self-assigned this
    on Nov 7, 2024
  4. sweatybridge commented on Nov 7, 2024

    @sweatybridge
    Contributor

    Thank you. I managed to reproduce the issue and pushed a fix.

    npx supabase@beta functions serve
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions