I'm trying to pull a library into my worker that has this toplevel declaration:
const neverSignal = new AbortController().signal;
const neverSignal = new AbortController().signal;
When I run
wrangler dev --experimental-local
wrangler dev --experimental-local
or
wrangler publish
wrangler publish
, I'm met with the following error:
service core:user:: Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.at index.js:24:19
service core:user:: Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.at index.js:24:19
(where the location points to the new AbortSignal line). I've noticed this only happens on real deployment and and with
--experimental-local
--experimental-local
, not with
--local
--local
.
I'm fairly new to the js/ts/workers world so am looking to understand if this is expected? From looking at the library code [1] I don't see a way to not trigger this. I could reach out to the library authors and ask if they can adapt the library for workers but besides [2] I did not find any good limitations regarding the use of abortcontroller in workers that would cause this error (and allow them to test for continued support)