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

Prerendering app that logs $page will incorrectly fail #10526

Closed
pngwn opened this issue Aug 10, 2023 · 0 comments · Fixed by #10567
Closed

Prerendering app that logs $page will incorrectly fail #10526

pngwn opened this issue Aug 10, 2023 · 0 comments · Fixed by #10567
Labels
bug Something isn't working

Comments

@pngwn
Copy link
Member

pngwn commented Aug 10, 2023

Describe the bug

Logging out parts of the URL that are not supported while prendering should be ignored due to out magical formatter.

A very clever cyborg fox told me this:

we have

tracked[Symbol.for('nodejs.util.inspect.custom')] = (depth, opts, inspect) => {
return inspect(url, opts);
};
which should be making console.log of the tracked URL object delegate to logging the original URL (and thus bypass the thing blocking access to url.hash) but maybe that broke at some point and/or doesn't work with certain Node versions.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-eh6kan?file=src%2Froutes%2F%2Bpage.svelte

Logs

Error: Cannot access url.search on a page with prerendering enabled
    at URL.get (file://.../_website/.svelte-kit/output/server/index.js:273:15)
    at [nodejs.util.inspect.custom] (node:internal/url:685:23)
    at formatValue (node:internal/util/inspect:785:19)
    at formatProperty (node:internal/util/inspect:1822:11)
    at formatRaw (node:internal/util/inspect:1033:9)
    at formatValue (node:internal/util/inspect:820:10)
    at inspect (node:internal/util/inspect:347:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2173:40)
    at formatWithOptions (node:internal/util/inspect:2035:10)
    at console.value (node:internal/console/constructor:324:14)
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

System Info

System:
    OS: macOS 13.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 13.25 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.3.0 - ~/.volta/tools/image/node/18.3.0/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 8.3.2 - ~/.volta/tools/image/npm/8.3.2/bin/npm
    pnpm: 8.6.7 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 112.1.50.114
    Chrome: 115.0.5790.170
    Safari: 16.4
    Safari Technology Preview: 16.4
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.1
    @sveltejs/adapter-static: ^2.0.2 => 2.0.2
    @sveltejs/adapter-vercel: ^3.0.3 => 3.0.3
    @sveltejs/kit: ^1.5.0 => 1.16.3
    svelte: ^3.59.2 => 3.59.2
    vite: ^4.3.9 => 4.3.9

Severity

annoyance

Additional Information

It is easily worked around (remove the logs), however figuring out that you need to remove the logs is relatively challenging.

@pngwn pngwn added the bug Something isn't working label Aug 10, 2023
@pngwn pngwn changed the title Prerendering app that logging $path will incorrectly fail Prerendering app that logs $path will incorrectly fail Aug 10, 2023
@eltigerchino eltigerchino changed the title Prerendering app that logs $path will incorrectly fail Prerendering app that logs $page will incorrectly fail Aug 16, 2023
dummdidumm pushed a commit that referenced this issue Aug 16, 2023
fixes #10526

We were allow logging when url.hash is disabled but not when url.search is disabled. Just copied over the same thing for when url.search is disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant