Skip to content

Node error if you try to console.log url param from page server file, crashes the page. #6385

@jhubbardsf

Description

@jhubbardsf

Describe the bug

If you have a +page.server.ts file and you try console log the event, or more specifically even the destructured url param, node will blow up and the page will fail to load. The exact error is in the logs below.

Reproduction

Create a new sveltekit demo app. App a /tester route with a +page.ts and a +page.server.ts file. Try to console.log the destructured url param or just the event object as a whole.

Logs

TypeError: inspect is not a function
    at URL.tracked.<computed> (file:///Users/josh/Engineering/SvelteKit/console-event-error/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.447_svelte@3.49.0+vite@3.0.9/node_modules/@sveltejs/kit/src/utils/url.js:108:10)
    at formatValue (node:internal/util/inspect:763:19)
    at formatProperty (node:internal/util/inspect:1681:11)
    at formatRaw (node:internal/util/inspect:1006:9)
    at formatValue (node:internal/util/inspect:793:10)
    at inspect (node:internal/util/inspect:340:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2006:40)
    at formatWithOptions (node:internal/util/inspect:1888:10)
    at console.value (node:internal/console/constructor:323:14)
    at console.log (node:internal/console/constructor:359:61)
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 12.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 81.44 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  Browsers:
    Brave Browser: 104.1.42.97
    Chrome: 104.0.5112.101
    Firefox: 103.0.2
    Firefox Developer Edition: 98.0
    Safari: 15.5
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.69
    @sveltejs/kit: next => 1.0.0-next.447
    svelte: ^3.46.0 => 3.49.0
    vite: ^3.0.8 => 3.0.9

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions