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: [BUG] #294

Open
yan5 opened this issue Jul 30, 2024 · 1 comment
Open

Bug: [BUG] #294

yan5 opened this issue Jul 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@yan5
Copy link

yan5 commented Jul 30, 2024

Describe the bug

I'm getting below error when I log as below

const reqBody = await event.request.formData();
log.info(reqBody)

event is https://kit.svelte.dev/docs/types#public-types-requestevent.
but it works fine if I do log.info(JSON.stringify(reqBody))

TypeError Cannot read properties of undefined (reading 'reduce')
error stack:
• undici [nodejs.util.inspect.custom]
internal/deps/undici/undici:4887
• inspect formatValue
internal/util/inspect:806
• inspect inspect
internal/util/inspect:365
• inspect formatWithOptionsInternal
internal/util/inspect:2304
• inspect formatWithOptions
internal/util/inspect:2166
• index.js Object.transportFormatted
/node_modules/.pnpm/[email protected]/node_modules/tslog/dist/esm/runtime/nodejs/index.js:107
• BaseLogger.js Logger.log
/node_modules/.pnpm/[email protected]/node_modules/tslog/dist/esm/BaseLogger.js:101
• index.js Logger.info
/node_modules/.pnpm/[email protected]/node_modules/tslog/dist/esm/index.js:26

• task_queues process.processTicksAndRejections
internal/process/task_queues:95

Screenshots
image

Additional context
Add any other context about the problem here.

Node.js Version
v20.16.0

Same issue with Bun 1.1.21 as well.

OS incl. Version
Ubuntu 24.04 LTS 6.8.0-39-generic

@yan5 yan5 added the bug Something isn't working label Jul 30, 2024
@PAStheLoD
Copy link

Hello,

We ran into the same (?) issue on Node v22.3.0 with tslog 4.9.3 (also via pnpm), also reading a fetch Response object (so stacktrace goes like formatWithOptions, inspect, formatValuie, [nodejs.util.inspect.custom] in undici, then get status).

(Also note that regarding the opening bug report undici has this warning: The body returned from undici.request does not implement .formData().)

Though it seems the root cause is likely that tslog does not handle errors during formatting of the log line. :/

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

No branches or pull requests

2 participants