Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: [ERROR] service core:user:worker: Uncaught TypeError: Invalid URL string. #7265

Open
niklasfjeldberg opened this issue Nov 15, 2024 · 4 comments
Assignees
Labels
awaiting Cloudflare response Awaiting response from workers-sdk maintainer team awaiting reporter response Needs clarification or followup from OP bug Something that isn't working

Comments

@niklasfjeldberg
Copy link

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:

compatibility_date="2024-09-02"
compatibility_flags=["nodejs_compat_v2"]

Commands used to build and start the server:

"build:cf": "nuxi build --preset=cloudflare_pages",
"start:cf": "wrangler pages dev ./dist", 

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

> wrangler pages dev ./dist


 ⛅️ wrangler 3.87.0
-------------------

Attaching additional modules:
┌──────────────────────────────────────────────────┬──────┬─────────────┐
│ Name                                             │ Type │ Size        │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/_/error-500.mjs                           │ esm  │ 4.77 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/_/getEventID.mjs                          │ esm  │ 15.62 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/_/v4.mjs                                  │ esm  │ 1.12 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Card-KF4IrUo8.mjs                   │ esm  │ 2.97 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/CountDown-styles-1.mjs-CH0ZZzdk.mjs │ esm  │ 0.89 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/CountDown-styles.BKj4Xvhz.mjs       │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/CountDown-styles.CGwOQvHt.mjs       │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/H1-v-IQiJYp.mjs                     │ esm  │ 1.00 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Input-CDCWq5lS.mjs                  │ esm  │ 14.66 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Issues-CPd3JfLI.mjs                 │ esm  │ 1.49 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/ModalSuccess-ChXYYXf3.mjs           │ esm  │ 3.67 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/P-CMudS6fj.mjs                      │ esm  │ 1.00 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/PrivacyPolicy-styles.B3HcKi4X.mjs   │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/PrivacyPolicy-styles.CJByC3os.mjs   │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Progress-styles-1.mjs-4EHqM8-a.mjs  │ esm  │ 4.12 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Progress-styles.DTk4nyp5.mjs        │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Progress-styles.Zz7EdMwu.mjs        │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/SalesTerms-styles.Bc2TFfJX.mjs      │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/SalesTerms-styles.ee9TT1Zh.mjs      │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/Toggle-Dk5b8jBa.mjs                 │ esm  │ 8.01 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/access-D0SCS43Z.mjs                 │ esm  │ 0.74 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/app-styles.Czy36uwh.mjs             │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/app-styles.DrXHc5d0.mjs             │ esm  │ 0.42 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/client.manifest.mjs                 │ esm  │ 10.98 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/entry-styles-3.mjs-7c6USuvS.mjs     │ esm  │ 0.83 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/entry-styles-4.mjs-WtlOUhWb.mjs     │ esm  │ 0.83 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/entry-styles-5.mjs-7RKY_Lto.mjs     │ esm  │ 0.67 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/entry-styles.D0A2Nx8i.mjs           │ esm  │ 90.92 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-404-d8fPDqmQ.mjs              │ esm  │ 4.67 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-404-styles-1.mjs-jZp64Wmo.mjs │ esm  │ 4.15 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-404-styles.DuH9qVr6.mjs       │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-404-styles.nUIDPVS_.mjs       │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-500-Bc2OhjVV.mjs              │ esm  │ 4.27 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-500-styles-1.mjs-BnZcnvru.mjs │ esm  │ 2.50 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-500-styles.BtK1-mlq.mjs       │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/error-500-styles.CUTndPYP.mjs       │ esm  │ 0.41 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/form-D9drBLMq.mjs                   │ esm  │ 1.96 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/gi-DXbeBcwb.mjs                     │ esm  │ 34.65 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/index-BG29HprR.mjs                  │ esm  │ 2.35 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/index-BtZC_Xak.mjs                  │ esm  │ 1.11 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/index-CdZmgY_X.mjs                  │ esm  │ 14.57 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/min-side-DCS1vJDq.mjs               │ esm  │ 93.56 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/server.mjs                          │ esm  │ 198.73 KiB  │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/ssn-CwSdRLNj.mjs                    │ esm  │ 9.07 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/styles.mjs                          │ esm  │ 3.19 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/takk-C-8xhe0l.mjs                   │ esm  │ 5.00 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/virtual_public-D7V6QAYH.mjs         │ esm  │ 0.69 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/build/workshop-Dyp3EBhU.mjs               │ esm  │ 11.80 KiB   │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/nitro/nitro.mjs                           │ esm  │ 432.15 KiB  │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/_id/segment-count.get.mjs      │ esm  │ 0.61 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/donate-success.post.mjs        │ esm  │ 0.83 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/donate.post.mjs                │ esm  │ 0.75 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/event-sign-up.post.mjs         │ esm  │ 1.56 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/privacy-policy.get.mjs         │ esm  │ 0.50 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/sales-terms.get.mjs            │ esm  │ 0.49 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/sign.post.mjs                  │ esm  │ 1.10 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/slack-message.post.mjs         │ esm  │ 0.56 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/api/ssn.post.mjs                   │ esm  │ 1.17 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/routes/renderer.mjs                       │ esm  │ 136.36 KiB  │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ chunks/virtual/_virtual_spa-template.mjs         │ esm  │ 0.33 KiB    │
├──────────────────────────────────────────────────┼──────┼─────────────┤
│ Total (60 modules)                               │      │ 1138.79 KiB │
└──────────────────────────────────────────────────┴──────┴─────────────┘
✨ Compiled Worker successfully
✨ Parsed 0 valid redirect rules.
✨ Parsed 4 valid header rules.
[wrangler:inf] Ready on http://localhost:8788
⎔ Starting local server...
✘ [ERROR] service core:user:worker: Uncaught TypeError: Invalid URL string.

    at null.<anonymous> (xjrypum68b8.js:37308:23) in createHook
    at null.<anonymous> (xjrypum68b8.js:37481:96)



✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.
@niklasfjeldberg niklasfjeldberg added the bug Something that isn't working label Nov 15, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Nov 15, 2024
@thescientist13
Copy link

thescientist13 commented Nov 17, 2024

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 - #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)

@CarmenPopoviciu
Copy link
Contributor

hi @niklasfjeldberg and @thescientist13,

Thank you for raising this issue with us. Any chance one of you can provide us with some minimal reproduction 🙏 ? I'm not able to reproduce the error you're seeing locally, so that would really help us narrow things down

<3

@CarmenPopoviciu CarmenPopoviciu added the awaiting reporter response Needs clarification or followup from OP label Nov 18, 2024
@thescientist13
Copy link

thescientist13 commented Nov 18, 2024

Hey @CarmenPopoviciu 👋

Here's a repro repo I made that has a couple minimal functions that work
https://github.com/thescientist13/cloudflare-workers-demo
https://cloudflare-workers-demo-4fb.pages.dev/

And then in this PR I added another function using new URL + import.meta.url that shows the error above when it builds on Cloudflare
thescientist13/cloudflare-workers-demo#1

Hope that helps, and let me know if you need any more info.

@CarmenPopoviciu
Copy link
Contributor

ah, this is fantastic!! thank you so much @thescientist13 🙏 . Going to have a look at this tomorrow morning, and see what's going on

@CarmenPopoviciu CarmenPopoviciu self-assigned this Nov 18, 2024
@CarmenPopoviciu CarmenPopoviciu added the awaiting Cloudflare response Awaiting response from workers-sdk maintainer team label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting Cloudflare response Awaiting response from workers-sdk maintainer team awaiting reporter response Needs clarification or followup from OP bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

3 participants