Error: process is not defined
# workers-help
m
My Worker keeps throwing an error when I run
wrangler dev
or
wrangler publish
. Here are the steps I took: 1. I created a new worker with wrangelr and added my code to the
src/index.js
file. 2. I updated my
wrangler.toml
file to this:
name = "my-project"\n
main = "src/index.js"
account_id = "redacted"
compatibility_date = "2023-04-27"
3. I installed Webpack and updated my
webpack.config.js
file. 4. I ran
wrangler publish
and got the following error: ✘ [ERROR] Error on remote worker: ParseError: A request to the Cloudflare API (/accounts/redacted/workers/scripts/my-project/edge-preview) failed. at throwFetchError (/Users/redacted/redacted/_cloudflare-workers/my-project/node_modules/wrangler/wrangler-dist/cli.js:130684:17) at fetchResult (/Users/redacted/redacted/_cloudflare-workers/my-project/node_modules/wrangler/wrangler-dist/cli.js:130651:5) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async createPreviewToken (/Users/redacted/redacted/_cloudflare-workers/my-project/node_modules/wrangler/wrangler-dist/cli.js:132627:29) at async createWorkerPreview (/Users/redacted/redacted/_cloudflare-workers/my-project/node_modules/wrangler/wrangler-dist/cli.js:132648:17) at async start (/Users/redacted/redacted/_cloudflare-workers/my-project/node_modules/wrangler/wrangler-dist/cli.js:151221:34) { text: 'A request to the Cloudflare API (/accounts/redacted/workers/scripts/my-project/edge-preview) failed.', notes: [ { text: 'Uncaught ReferenceError: process is not defined\n' + ' at index.js:2671:11\n' + ' [code: 10021]' } ], location: undefined, kind: 'error', code: 10021 } I'm not really sure what this error means or how to fix this. Anyone know what the problem is?
k
Sounds like you have a dependency that's relying on
process
which isn't a thing in Workers