Skip to content

Unable to inspect worker: "worker boot error: Uncaught SyntaxError: Unexpected non-whitespace character after JSON" #456

Closed
@0x5457

Description

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

If I start the main worker with --inspect-main --inspect-brk args and import the json file in the main worker code, the following error will occur

2024-12-02T10:52:42.988080Z ERROR ThreadId(03) base::rt_worker::implementation::default_handler: worker boot error: Uncaught SyntaxError: Unexpected non-whitespace character after JSON at position 574 (line 20 column 1)    
Error: main worker boot error: worker boot error

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

main worker code:

import { STATUS_CODE } from "jsr:@std/http";
console.log(STATUS_CODE.Accepted);

run edge-runtime with --inspect-main and --inspect-brk

./target/debug/edge-runtime "$@" start \
    --inspect-main \
    --inspect-brk \
    --main-service ./test-main

Expected behavior

The main worker runs normally and waits for debugging to start

Screenshots

image

System information

  • OS: macOS

Additional context

The reason for the error may be that the inline sourcemap is added to the json file here:

src.push_str("//# sourceMappingURL=data:application/json;base64,");
base64::prelude::BASE64_STANDARD.encode_string(source_map, &mut src);

Metadata

Assignees

Labels

bugSomething isn't workingreleased

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions