Pages "Worker threw exception Error 1101"

Hi guys, I have semi-successfully deployed my SvelteKit application to Cloudflare Pages (connected via GitHub repository). It tells me in the logs that the build was successful, however when I go to the URL it tells me it's not working! D: (see attached) Any ideas how I can go about debugging/fixing this? Below is parts of the build log I thought could be relevant:
22:50:44.616 Successfully installed @sveltejs/adapter-cloudflare.
22:50:44.616
22:50:44.616 If you plan on staying on this deployment platform, consider replacing @sveltejs/adapter-auto with @sveltejs/adapter-cloudflare. This will give you faster and more robust installs, and more control over deployment configuration.
22:50:44.616
22:50:45.386 ✔ done
22:50:45.482 Finished
22:50:45.482 Found _worker.js in output directory. Uploading.
22:50:46.703 ▲ [WARNING] 6 warning(s) when compiling Worker.
22:50:46.704
22:50:46.704
22:50:46.750 Found _routes.json in output directory. Uploading.
22:50:46.764 Validating asset output directory
22:50:47.626 Deploying your site to Cloudflare's global network...
22:50:50.157 Parsed 2 valid header rules.
22:50:51.335 Uploading... (5/23)
22:50:52.998 Uploading... (11/23)
22:50:53.333 Uploading... (17/23)
22:50:54.871 Uploading... (23/23)
22:50:54.871 ✨ Success! Uploaded 18 files (5 already uploaded) (3.83 sec)
22:50:54.871
22:50:55.130 ✨ Upload complete!
22:50:57.726 Success: Assets published!
22:51:02.705 Success: Your site was deployed!
22:50:44.616 Successfully installed @sveltejs/adapter-cloudflare.
22:50:44.616
22:50:44.616 If you plan on staying on this deployment platform, consider replacing @sveltejs/adapter-auto with @sveltejs/adapter-cloudflare. This will give you faster and more robust installs, and more control over deployment configuration.
22:50:44.616
22:50:45.386 ✔ done
22:50:45.482 Finished
22:50:45.482 Found _worker.js in output directory. Uploading.
22:50:46.703 ▲ [WARNING] 6 warning(s) when compiling Worker.
22:50:46.704
22:50:46.704
22:50:46.750 Found _routes.json in output directory. Uploading.
22:50:46.764 Validating asset output directory
22:50:47.626 Deploying your site to Cloudflare's global network...
22:50:50.157 Parsed 2 valid header rules.
22:50:51.335 Uploading... (5/23)
22:50:52.998 Uploading... (11/23)
22:50:53.333 Uploading... (17/23)
22:50:54.871 Uploading... (23/23)
22:50:54.871 ✨ Success! Uploaded 18 files (5 already uploaded) (3.83 sec)
22:50:54.871
22:50:55.130 ✨ Upload complete!
22:50:57.726 Success: Assets published!
22:51:02.705 Success: Your site was deployed!
No description
5 Replies
josh
joshOP8mo ago
Sorry I'm not familiar with doing that. What is that and how could I do it? Is there any documentation I could read? Hey I think I found a way to view logs through the functions "real time logs", I now have something to look at:
"outcome": "exception",
"scriptName": "pages-worker--2373285-production",
"diagnosticsChannelEvents": [],
"exceptions": [
{
"stack": " at loadApiEnv (functionsWorker-0.9745412370800839.js:4702:7)\n at Object.get (functionsWorker-0.9745412370800839.js:4871:26)\n at node_modules/@clerk/clerk-sdk-node/dist/esm/index.mjs (functionsWorker-0.9745412370800839.js:4900:7)\n at __init (functionsWorker-0.9745412370800839.js:9:56)\n at .svelte-kit/output/server/chunks/hooks.server.js (functionsWorker-0.9745412370800839.js:4943:5)\n at __init (functionsWorker-0.9745412370800839.js:9:56)\n at functionsWorker-0.9745412370800839.js:4970:44\n at async get_hooks (functionsWorker-0.9745412370800839.js:4970:8)\n at async Server.init (functionsWorker-0.9745412370800839.js:33856:24)\n at async Object.fetch (functionsWorker-0.9745412370800839.js:33995:5)",
"name": "ReferenceError",
"message": "process is not defined",
"timestamp": 1712656221011
}
],
"logs": [],
"eventTimestamp": 1712656220994,
"outcome": "exception",
"scriptName": "pages-worker--2373285-production",
"diagnosticsChannelEvents": [],
"exceptions": [
{
"stack": " at loadApiEnv (functionsWorker-0.9745412370800839.js:4702:7)\n at Object.get (functionsWorker-0.9745412370800839.js:4871:26)\n at node_modules/@clerk/clerk-sdk-node/dist/esm/index.mjs (functionsWorker-0.9745412370800839.js:4900:7)\n at __init (functionsWorker-0.9745412370800839.js:9:56)\n at .svelte-kit/output/server/chunks/hooks.server.js (functionsWorker-0.9745412370800839.js:4943:5)\n at __init (functionsWorker-0.9745412370800839.js:9:56)\n at functionsWorker-0.9745412370800839.js:4970:44\n at async get_hooks (functionsWorker-0.9745412370800839.js:4970:8)\n at async Server.init (functionsWorker-0.9745412370800839.js:33856:24)\n at async Object.fetch (functionsWorker-0.9745412370800839.js:33995:5)",
"name": "ReferenceError",
"message": "process is not defined",
"timestamp": 1712656221011
}
],
"logs": [],
"eventTimestamp": 1712656220994,
I have tried installing the process NPM package but still have the same error I assume the clerk-sdk-node package uses process somewhere? And Cloudflare Pages does not hhave that. Am I right in understanding process is typically a default thing in Node, but Pages runs its "own modified version" of Node? Or at least is that the gist of it?
Chaika
Chaika8mo ago
Page Functions are just Cloudflare Workers with some sugar/magic around them, and Workers aren't node at all. They use the v8 Javascript Engine -- same as Chrome: https://developers.cloudflare.com/workers/reference/how-workers-works/ You have a "web like environment". There is some nodejs compatability you can enable, but it's mostly just re-implementing some node functions, still not going to have process or any file system.
josh
joshOP8mo ago
Thanks for clarifying my misunderstanding <3 What route would you suggest I take to resolving the lack of process? Thanks, that's useful I now know it can exist! Though with Pages, I don't have a wrangler.toml file so I am unsure where I could put the flag mentioned? I'll do some Googling too
Chaika
Chaika8mo ago
In your pages project -> Settings -> Functions -> Configure Production compatibility flags -> nodejs_compat it'd only work if the package is importing from node:process and not process, and like I said above you're not going to the actual process, can't have child processes, etc
josh
joshOP8mo ago
Yeah I'm not sure what the Clerk packages use exactly, I assume they're using process for env variables... I'm pretty stumped on what to do haha
Want results from more Discord servers?
Add your server