This repository demonstrates a bug in Supabase's Edge Functions where the deno.jsonc
file is not fully supported, despite being explicitly recommended for use (see Using deno.jsonc (recommended)).
The issue arises when the deno.jsonc
file includes JSONC-specific features like comments (line or block) or trailing commas, which cause the edge functions to fail.
Bug report: supabase/cli#3050
Expected behavior:
Supabase should support the deno.jsonc
file format as advertised, including all JSONC features (comments and trailing commas).
Actual behavior:
Edge functions only support deno.jsonc
files that are valid JSON (without comments or trailing commas).
Edge functions using JSONC-specific features fail with the following error message:
InvalidWorkerCreation: worker boot error: Unable to parse import map JSON: key must be a string at line 3 column 5
at async UserWorker.create (ext:sb_user_workers/user_workers.js:139:15)
at async Object.handler (file:///root/index.ts:156:22)
at async respond (ext:sb_core_main_js/js/http.js:197:14) {
name: "InvalidWorkerCreation"
}
And edge function response:
{"code":"BOOT_ERROR","message":"Worker failed to boot (please check logs)"}
This repository includes six edge functions to showcase the behavior:
- Working functions:
import-map
: Uses a validimport_map.json
file.deno-json
: Uses avalid deno.json
file.deno-jsonc-with-json
: Uses adeno.jsonc
file with valid JSON (without comments or trailing commas).
- Failing functions:
deno-jsonc-with-line-comment
: Uses adeno.jsonc
file with line comments.deno-jsonc-with-block-comment
: Uses adeno.jsonc
file with block comments.deno-jsonc-with-trailing-comma
: Uses adeno.jsonc
file with trailing commas.
- Clone this repository.
- Start Supabase (
cd supabase
,supabase start
, and optionallysupabase functions serve
). - Invoke the edge functions (for example with the
test-edge-functions.sh
script or using curl) observe the results.
This repository is open-source and available under the MIT License.