One of my existing Subhosting projects recently can't be deployed anymore, because the new deployments fail with this error:
The deployment failed: UNCAUGHT_EXCEPTION
TypeError: failed to receive BroadcastChannel message
at async recv (ext:deno_broadcast_channel/01_broadcast_channel.js:41:21)
This error only seems to crash my deployment when the module uses await fetch() at the top level, e.g. blocking the isolate startup.
The last green deployment was from 4 days ago and still served traffic without error. It's seemingly just the deploy verification step that has begun failing.
Steps to reproduce
The error message can be reproduced in a Playground like so:
new BroadcastChannel('hello');
await fetch(`https://da.gd/ip`).then(x => x.text());
Deno.serve((req: Request) => new Response("Hello World!"));
Note that the playground still deploys ok, but the us-east-1 isolate never started listening:
gcp-us-east4 isolate start time: 17.85 ms (user time: 7.26 ms)
gcp-us-east4 TypeError: failed to receive BroadcastChannel message
at async recv (ext:deno_broadcast_channel/01_broadcast_channel.js:41:21)
gcp-europe-west3 Listening on https://127.0.0.1:80/
gcp-europe-west3 isolate start time: 769.32 ms (user time: 642.64 ms)
If you remove the fetch() like so:
new BroadcastChannel('hello');
Deno.serve((req: Request) => new Response("Hello World!"));
Now the verification isolate in us-east4 successfully listens, despite the error still being logged:
gcp-us-east4 Listening on https://127.0.0.1:80/
gcp-us-east4 isolate start time: 16.57 ms (user time: 6.90 ms)
gcp-us-east4 TypeError: failed to receive BroadcastChannel message
at async recv (ext:deno_broadcast_channel/01_broadcast_channel.js:41:21)
gcp-europe-west3 Listening on https://127.0.0.1:80/
gcp-europe-west3 isolate start time: 89.07 ms (user time: 6.50 ms)
I'm not sure why the deployment only fully fails with Deploy Subhosting (vs Deploy Playground).
Expected behavior
There shouldn't be an error related to the BroadcastChannel, and the deployment should succeed.
Environment
Deno Deploy, via subhosting API
Possible solution
The workarounds I've found are to either:
Not use BroadcastChannel
Not use await fetch() at the top level of my program
Problem description
One of my existing Subhosting projects recently can't be deployed anymore, because the new deployments fail with this error:
This error only seems to crash my deployment when the module uses
await fetch()
at the top level, e.g. blocking the isolate startup.The last green deployment was from 4 days ago and still served traffic without error. It's seemingly just the deploy verification step that has begun failing.
Steps to reproduce
The error message can be reproduced in a Playground like so:
Note that the playground still deploys ok, but the
us-east-1
isolate never started listening:If you remove the fetch() like so:
Now the verification isolate in
us-east4
successfully listens, despite the error still being logged:I'm not sure why the deployment only fully fails with Deploy Subhosting (vs Deploy Playground).
Expected behavior
There shouldn't be an error related to the BroadcastChannel, and the deployment should succeed.
Environment
Deno Deploy, via subhosting API
Possible solution
The workarounds I've found are to either:
BroadcastChannel
await fetch()
at the top level of my programAdditional context
No response