Closed essesoul closed 3 months ago
Did you use nodejs_compat
or nodejs_als
as the compatibility flag? The nodejs_als
flag only gives access to the node:async_hooks
import. For node:buffer
you need nodejs_compat
.
(Also you could try out the new experimental Node.js compatibility option we are trialling by adding experimental:nodejs_compat_v2
flag.)
The contents of the wrangler.toml file are as follows:
name = "url-sign"
main = "worker.js"
compatibility_date = "2024-07-15"
compatibility_flags = [ "nodejs_compat" ]
I tried experimental:nodejs_compat_v2
and still got the same error, is my formatting wrong?
Can you provide a link to a github repository that we can clone and test?
I get an error after clicking deploy after editing online on cloudflare workers&pages
My code was copied from the https://developers.cloudflare.com/workers/examples/signing-requests/ page
I've tried using CLI deployment and it works fine already.
Perhaps there is a vulnerability in online deployment.
Oh did you create a wrangler.toml
file in the Dashboard editor?
If so, that won't work because we don't process that file online - it is only a Wrangler CLI thing.
Instead, online, you need to go and update the compat flags in the settings part of the dashboard for the Worker.
Yes, I edited wrangler.toml online and now I've solved it.
Which Cloudflare product(s) does this pertain to?
Workers for Platforms
What version(s) of the tool(s) are you using?
.
What version of Node are you using?
No response
What operating system and version are you using?
windows11
Describe the Bug
When I try to create a worker according to https://developers.cloudflare.com/workers/examples/signing-requests/ ,I get "Uncaught Error: No such module " node:buffer". imported from "worker.js" (Code: 10021)".
I have added "compatibility_flags = [ "nodejs_als" ]" to wrangler.toml as per instructions.
worker.js
wrangler.toml
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response