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

should the build complete when exceptions throw? #2727

Closed
brandonmp opened this issue Nov 1, 2017 · 8 comments
Closed

should the build complete when exceptions throw? #2727

brandonmp opened this issue Nov 1, 2017 · 8 comments

Comments

@brandonmp
Copy link
Contributor

When my build fails b/c of a plugin throwing an exception, the build seems to complete on Netlify & even goes as far as deploying the broken build. Here's some output from last time it happened:

1:17:40 PM: 

  Error: socket hang up
  
  - next_tick.js:138 _combinedTickCallback
    internal/process/next_tick.js:138:11
  
  - next_tick.js:180 process._tickCallback
    internal/process/next_tick.js:180:9
  
1:17:42 PM: success source and transform nodes — 17.172 s
1:17:44 PM: success building schema — 1.879 s
1:17:44 PM: success createLayouts — 0.017 s
1:17:44 PM: Starting: Blog pages.
1:17:45 PM: error Plugin default-site-plugin returned an error
1:17:45 PM: 

  Error: 
1:17:45 PM: success createPages — 0.052 s
1:17:45 PM: success createPagesStatefully — 0.070 s
1:17:45 PM: GraphQL Error Unknown field `allContentfulBusinessSchool` on type `RootQueryType`

  file: /opt/build/repo/src/layouts/index.js

   1 | 
   2 |     query getNavMenuSchoolLinks {
>  3 |         allContentfulBusinessSchool {
     |         ^
   4 |             edges {
   5 |                 node {
   6 |                     name
   7 |                 }
   8 |             }
   9 |         }
  10 |     }
  11 |
1:17:45 PM: success extract queries from components — 0.590 s

The original source of the error is a plugin I wrote, but I don't have any catch statements in the plugin, so if the plugin isn't swallowing the error, what's stopping it from crashing the build process (which I would assume is desired functionality)?

@KyleAMathews
Copy link
Contributor

Nope! We should be failing on exceptions.

@blackwood
Copy link

Curious — is this issue still open? I have a similar build process, and am hesitating on using source plugins without knowing that the build can fail.

@ricopags
Copy link

Is this issue still open? Looking to use google sheets as a source but the plugin references this issue as being a deal breaker. Maybe there's another way the plugin could signal failure without using the built in methods?

@brandonmp
Copy link
Contributor Author

brandonmp commented Apr 16, 2018

@ricopags that's an idea (sheets plugin author here). i could add an option to call process.kill or something in the event of a failure.

it's a bit extreme, but i imagine that, for most ppl, shutting the whole thing down is preferable to deploying with broken data

@12finger
Copy link
Contributor

12finger commented Jul 6, 2018

any news on this @KyleAMathews , @brandonmp ?

@KyleAMathews
Copy link
Contributor

This was fixed a while ago — if plugins throw an error, we kill the process (during builds) —

if (process.env.NODE_ENV === `production`) {

@antmonnier
Copy link

This warning should probably be removed: https://www.gatsbyjs.com/plugins/gatsby-source-google-sheets/#heads-up

This was referenced Jan 12, 2022
This was referenced Feb 9, 2022
@saaqibz
Copy link

saaqibz commented Jan 27, 2023

This warning should probably be removed: https://www.gatsbyjs.com/plugins/gatsby-source-google-sheets/#heads-up

FYI was playing around with gatsby and noticed this warning is still there. Might be worth removing it to reduce confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants