-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-plugin-sharp): avoid joi validation error when using reporter.panic #28291
fix(gatsby-plugin-sharp): avoid joi validation error when using reporter.panic #28291
Conversation
- previously just passing the error object would produce a joi error ``` Failed to validate error Error [ValidationError]: "name" is not allowed at Object.exports.process (/myproject/node_modules/@hapi/joi/lib/errors.js:202:19) at internals.Object._validateWithOptions (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:763:31) at internals.Object.validate (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:797:21) at constructError (/myproject/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32) at Reporter.error (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59) at Reporter.panic (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34) at Object.panic (/myproject/node_modules/gatsby/src/utils/api-runner-node.js:201:16) at /myproject/node_modules/gatsby-plugin-sharp/index.js:162:14 { isJoi: true, ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
It seems something is throwing an object with unexpected name
field here, right? In any case - this is ok to get in as-is
When I tried artificially cause this:
I got
Failed to validate error Error [ValidationError]: "name" is not allowed
at Object.exports.process (/Users/misiek/dev/gatsby-starter-blog/node_modules/@hapi/joi/lib/errors.js:202:19)
at internals.Object._validateWithOptions (/Users/misiek/dev/gatsby-starter-blog/node_modules/@hapi/joi/lib/types/any/index.js:763:31)
at internals.Object.validate (/Users/misiek/dev/gatsby-starter-blog/node_modules/@hapi/joi/lib/types/any/index.js:797:21)
at constructError (/Users/misiek/dev/gatsby-starter-blog/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32)
at Reporter.error (/Users/misiek/dev/gatsby-starter-blog/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59)
at Reporter.panic (/Users/misiek/dev/gatsby-starter-blog/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34)
at Object.panic (/Users/misiek/dev/gatsby-starter-blog/node_modules/gatsby/src/utils/api-runner-node.js:201:16)
at /Users/misiek/dev/gatsby-starter-blog/node_modules/gatsby-plugin-sharp/index.js:162:14 {
isJoi: true,
details: [
{
message: '"name" is not allowed',
path: [Array],
type: 'object.allowUnknown',
context: [Object]
}
],
_object: {
context: {},
name: 'WorkerError',
pluginName: 'gatsby-transformer-sharp',
text: 'There was an error',
level: 'ERROR',
stack: [],
docsUrl: 'https://gatsby.dev/issue-how-to'
},
annotate: [Function]
}
and with your change I got:
ERROR
[object Object] {"name":true}
WorkerError: {"name":true}
- jobs-manager.ts:318 enqueueJob
[gatsby-starter-blog]/[gatsby]/src/utils/jobs-manager.ts:318:21
Which is still not great, but at least the thrown thing is not hidden
Thanks again!
- previously just passing the error object would produce a joi error ``` Failed to validate error Error [ValidationError]: "name" is not allowed at Object.exports.process (/myproject/node_modules/@hapi/joi/lib/errors.js:202:19) at internals.Object._validateWithOptions (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:763:31) at internals.Object.validate (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:797:21) at constructError (/myproject/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32) at Reporter.error (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59) at Reporter.panic (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34) at Object.panic (/myproject/node_modules/gatsby/src/utils/api-runner-node.js:201:16) at /myproject/node_modules/gatsby-plugin-sharp/index.js:162:14 { isJoi: true, ``` (cherry picked from commit 231cf9f)
- previously just passing the error object would produce a joi error ``` Failed to validate error Error [ValidationError]: "name" is not allowed at Object.exports.process (/myproject/node_modules/@hapi/joi/lib/errors.js:202:19) at internals.Object._validateWithOptions (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:763:31) at internals.Object.validate (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:797:21) at constructError (/myproject/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32) at Reporter.error (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59) at Reporter.panic (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34) at Object.panic (/myproject/node_modules/gatsby/src/utils/api-runner-node.js:201:16) at /myproject/node_modules/gatsby-plugin-sharp/index.js:162:14 { isJoi: true, ``` (cherry picked from commit 231cf9f)
…28321) - previously just passing the error object would produce a joi error ``` Failed to validate error Error [ValidationError]: "name" is not allowed at Object.exports.process (/myproject/node_modules/@hapi/joi/lib/errors.js:202:19) at internals.Object._validateWithOptions (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:763:31) at internals.Object.validate (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:797:21) at constructError (/myproject/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32) at Reporter.error (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59) at Reporter.panic (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34) at Object.panic (/myproject/node_modules/gatsby/src/utils/api-runner-node.js:201:16) at /myproject/node_modules/gatsby-plugin-sharp/index.js:162:14 { isJoi: true, ``` (cherry picked from commit 231cf9f) Co-authored-by: rburgst <rburgst@gmail.com>
I just published It might take some time to propagate ( |
…28322) - previously just passing the error object would produce a joi error ``` Failed to validate error Error [ValidationError]: "name" is not allowed at Object.exports.process (/myproject/node_modules/@hapi/joi/lib/errors.js:202:19) at internals.Object._validateWithOptions (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:763:31) at internals.Object.validate (/myproject/node_modules/@hapi/joi/lib/types/any/index.js:797:21) at constructError (/myproject/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:52:32) at Reporter.error (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:135:59) at Reporter.panic (/myproject/node_modules/gatsby-cli/lib/reporter/reporter.js:75:34) at Object.panic (/myproject/node_modules/gatsby/src/utils/api-runner-node.js:201:16) at /myproject/node_modules/gatsby-plugin-sharp/index.js:162:14 { isJoi: true, ``` (cherry picked from commit 231cf9f) Co-authored-by: rburgst <rburgst@gmail.com>
Description
fix joi error when image conversion fails
previously just passing the error object would produce the following joi error
Related Issues