Open niklasfjeldberg opened 1 day ago
Getting a similar error when deploying a function to Cloudflare
19:23:54.615 | Found Functions directory at /functions. Uploading.
-- | --
19:23:54.622 | โ
๏ธ wrangler 3.76.0
19:23:54.622 | -------------------
19:23:55.871 | โจ Compiled Worker successfully
19:23:55.917 | Validating asset output directory
19:23:57.554 | Deploying your site to Cloudflare's global network...
19:24:01.343 | Uploading... (19/19)
19:24:01.344 | โจ Success! Uploaded 0 files (19 already uploaded) (0.46 sec)
19:24:01.344 | ย
19:24:01.687 | โจ Upload complete!
19:24:03.367 | Success: Assets published!
19:24:05.004 | Error: Failed to publish your Function. Got error: Uncaught TypeError: Invalid URL string. at functionsWorker-0.8204575732284836.js:46232:25 in products/products.route.js at functionsWorker-0.8204575732284836.js:5:59 in __init at functionsWorker-0.8204575732284836.js:46268:5 in products/index.js at functionsWorker-0.8204575732284836.js:5:59 in __init at functionsWorker-0.8204575732284836.js:46277:5 in ../../../pages/build_tool/js/.wrangler/tmp/pages-u2mHuu/functionsRoutes-0.967709881045554.mjs at functionsWorker-0.8204575732284836.js:5:59 in __init at functionsWorker-0.8204575732284836.js:46298:1
My hunch is that the issue is related to usage of new URL
+ import.meta.url
in my code, since I had a similar issue when deploying the exact same code output to Netlify, which also uses esbuild and has a known issue with processing import.meta.url
, and I understand that Wrangler is also using esbuild.
However, unlike Netlify, there seems to be no way to opt-out of bundling with esbuild that I can find, other than through the CLI and the --no-bundle
flag, which I'm not using (just using the git integration + functions/ directory).
I would love to be able to do through wrangler.toml, but it seems like that is not supported - https://github.com/cloudflare/workers-sdk/issues/6434 ? For example, with Netlify I can do this in their netlify.toml and nothing will get processed.
[build.processing]
skip_processing = true
The same code works fine on Vercel using their Build Output API.
(I'm basically testing the same code sample across all hosting providers)
Which Cloudflare product(s) does this pertain to?
Pages
What version(s) of the tool(s) are you using?
3.87.0
What version of Node are you using?
22.11.0
What operating system and version are you using?
Linux (WSL)
Describe the Bug
Observed behavior
I have made a website with Nuxt 3 (v3.14.159) and when I try to run the website locally as CF Pages (also the same error on Cloudflare Pages own servers) I get the following error:
[ERROR] service core:user:worker: Uncaught TypeError: Invalid URL string
The error log is not helpful for me as I am unable to locate and find out whats wrong.
Expected behavior
It should not give an error.
Steps to reproduce
I am not able to provide a public repo or minimal working code, but can provide the repo to the devs here. If no one else have any helpful advice.
This is how my
wrangler.toml
file looks like:Commands used to build and start the server:
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs