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

incompatible with mongoose: ValidationError has a read-only toJSON function #61

Closed
zoli-kasa opened this issue Oct 1, 2021 · 1 comment
Assignees
Labels

Comments

@zoli-kasa
Copy link

What happens?

TypeError: Cannot assign to read only property 'toJSON' of object 'ValidationError: XXXXXX'
at Function.stubError (\node_modules\lambda-log\lib\LogMessage.js:231:16)
at LogMessage.get meta [as meta] (\node_modules\lambda-log\lib\LogMessage.js:112:32)
at LogMessage.get value [as value] (\node_modules\lambda-log\lib\LogMessage.js:174:15)
at LogMessage.toJSON (\node_modules\lambda-log\lib\LogMessage.js:206:27)
at LambdaLog.log (\node_modules\lambda-log\lib\LambdaLog.js:156:36)
...

What were you expecting to happen?

not to throw an error
...

Steps to reproduce

  1. Define a read-only toJSON function on an error object
  2. Try to log it as metadata

Environment

Operating System: ubuntu+windows10
Node Version: 14.17
Lambda Log Version: 3.0.1

@KyleRoss KyleRoss self-assigned this Oct 1, 2021
@KyleRoss KyleRoss added the bug label Oct 1, 2021
github-actions bot pushed a commit that referenced this issue Oct 1, 2021
## [3.0.2](v3.0.1...v3.0.2) (2021-10-01)

### Bug Fixes

* skip adding a toJSON method to errors that already have one ([#61](#61)) ([5b03656](5b03656))
@KyleRoss
Copy link
Owner

KyleRoss commented Oct 1, 2021

@zoli-kasa This has been resolved in v3.0.2 which has been published to NPM. Thanks for reporting!

@KyleRoss KyleRoss closed this as completed Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants