-
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
[gatsby-source-filesystem] errors are ignored in createRemoteFileNode #6643
Comments
Is this for a custom source plug-in? |
Yes. |
This is probably what you need https://next.gatsbyjs.org/docs/migrating-from-v1-to-v2/#createremotefilenode |
Hmm ... I didn't present this problem in a correct way :) I know about the new exports.sourceNodes = async ({ actions, store, cache }) => {
const { createNode, createNodeId } = actions
// ...
}
I already solved my problem, you can close this issue if you wish. Just wanted to point this out ;) This is the right way to destructure props: exports.sourceNodes = async ({ actions, createNodeId, store, cache }) => {
const { createNode } = actions
// ...
} |
Yeah, validating the options and throwing an error sounds like a great plan. Would you like to PR that? |
Sure. I'm rather busy ATM, but will try to find some time to look at the situation ;) |
@KyleAMathews I looked at the code a little bit. The error is ignored in the async function processRemoteNode({
url,
store,
cache,
createNode,
auth = {},
createNodeId,
}) {
try {
// ...
} catch (err) {
// ignore <<<<<<<<<<<<<<<< HERE
}
return null
} We could throw err there, but then what's the point of even having a try catch block? Or did you mean that we should throw in options are invalid? Are there any examples on how to validate the options, or should we simply check for the presence of all required parameters such as |
I just ran into this as well because of some 404s. The silent failure made this pretty hard to debug when using gatsby-source-drupal. |
fixes gatsbyjs#6643 I also fell for this error before, sinc the original errors are swallowed (and fairly unclear too, because of the indirection). Adding validation was suggested in linked issue, so I went for this, since I didn't see any already used object validation like "ow" in use here.
…10123) fixes #6643 I also fell for this error before, sinc the original errors are swallowed (and fairly unclear too, because of the indirection). Adding validation was suggested in linked issue, so I went for this, since I didn't see any already used object validation like "ow" in use here. <!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ -->
…atsbyjs#10123) fixes gatsbyjs#6643 I also fell for this error before, sinc the original errors are swallowed (and fairly unclear too, because of the indirection). Adding validation was suggested in linked issue, so I went for this, since I didn't see any already used object validation like "ow" in use here. <!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ -->
fixed in #12348 |
…atsbyjs#10123) fixes gatsbyjs#6643 I also fell for this error before, sinc the original errors are swallowed (and fairly unclear too, because of the indirection). Adding validation was suggested in linked issue, so I went for this, since I didn't see any already used object validation like "ow" in use here. <!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ -->
Took me a while to find a bug in my
sourceNodes
code, because errors are ignored increateRemoteFileNode
inside processRemoteNode function.I kept getting
null
back fromcreateRemoteFileNode
. So after some digging, I put a console.log directly into gatsby-source-filesystem inside my node_modules and see the errorMaybe we can do something about that?
The text was updated successfully, but these errors were encountered: