FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

fail to deploy functions that use deno workspace packages

Fresh3 days ago
Mar 14, 20260 views
Confidence Score55%
55%

Problem

Bug report - [X] I confirm this is a bug with Supabase, not with my own application. - [X] I confirm I have searched the Docs, GitHub Discussions, and Discord. Describe the bug functions deploy fails to deploy functions with workspace dependencies To Reproduce See the following project: https://codesandbox.io/p/devbox/elastic-chatterjee-forked-6496py?workspaceId=ws_VGZMLHNu2hWPYZLrXEYbsU you can see the supabase function in supabase/functions/example. Attempting to deploy this will fail. However `deno run index.ts` works as expected Expected behavior `pnpx supabase functions deploy` deploys the function and resolves the workspace dependencies in the same way that deno does. Screenshots If applicable, add screenshots to help explain your problem. System information - Version of supabase-js: 2.20.12 - Version of Node.js: v22.14.0 Additional context note that it fails with the following error: [code block] because deno can resolve the workspace packages without a scheme. But it seems supabase cannot resolve workspace files in the same way.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Fix Supabase Function Deployment with Deno Workspace Packages

Medium Risk

The issue arises because Supabase's deployment process does not correctly resolve Deno workspace dependencies that lack a scheme. Deno can handle these dependencies seamlessly, but Supabase's deployment tool requires explicit resolution of workspace paths, leading to deployment failures.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Update Supabase CLI

    Ensure you are using the latest version of the Supabase CLI, as updates may include fixes for handling Deno workspace packages.

    bash
    npm install -g supabase
  2. 2

    Specify Workspace Dependencies

    Modify your function's import statements to include the full path to the workspace dependencies, ensuring they are correctly resolved during deployment.

    typescript
    import { myFunction } from '../my-workspace/myFunction.ts';
  3. 3

    Use Deno Deploy Configuration

    Create a `deno.json` configuration file in your project root if it doesn't exist. This file should specify the workspace dependencies explicitly.

    json
    {
      "imports": {
        "myFunction": "./my-workspace/myFunction.ts"
      }
    }
  4. 4

    Test Locally

    Run the function locally using Deno to ensure that all workspace dependencies are correctly resolved before attempting to deploy.

    bash
    deno run --allow-net index.ts
  5. 5

    Deploy Function

    Attempt to deploy the function again using the Supabase CLI. Ensure that the command is executed from the root of your project directory.

    bash
    pnpx supabase functions deploy example

Validation

Confirm that the function deploys successfully without errors. Additionally, test the deployed function to ensure it behaves as expected with the workspace dependencies.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

supabasepostgresqlbackendbugexternal-issueto-triage