-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Logging url.searchParams in server load function crashes #11482
Comments
You're trying to access url.searchParams directly, but you should use the 'get' method to access the value of a specific parameter. Example:
|
Can't the URL's searchParams property be accessed directly? The following code works in Node.js const url = new URL('https://example.com?foo=1&bar=2');
const params1 = new URLSearchParams(url.search);
console.log(params1);
// URLSearchParams { 'foo' => '1', 'bar' => '2' }
console.log(url.searchParams);
// URLSearchParams { 'foo' => '1', 'bar' => '2' } |
This solution logs in the console the result you're trying to see:
but if you want to retrieve the value you should treat it similarly to a map
Check this links out to clear any doubt you might still have: |
You really don't get anything useful from logging url.searchParams. The output will be EDIT: I'm sorry. It does contain useful info |
Having this bug as well, would disagree it's not useful to log all the search params. Sometimes you just wanna see what you're working with then everything crashes. Maybe it could not do that? |
Yeah url.searchParams should be loggable, even if it shows the iterable size Crashing when trying to log is not ideal, neither node nor the browser error on this. |
Thanks everyone for the persistence on this. Found a fix and it indeed does contain useful information when logged. |
Describe the bug
The following server load function fails in a Node.js environment.
Works in a universal load function and in StackBlitz environment.
Reproduction
pnpm create svelte@latest # version 6.0.5
Logs
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: