Build script returned non-zero exit code: 1 on a gatsby site

I need some advice to debug this deploy

The same command (gatsby build) is working locally. It’s a standard gatsby site - gatsby advanced theme.

The changes since the previous deployment include a commit which removes the dependency (gatsby-plugin-react-svg) from the solution. This dependency was added first by me and then removed when I realised I’m not using it anymore.

I can’t think what is causing this issue nor can I see any logs that indicate what could be causing it. My next step is to rollback the commits in the last deployment and deploy it again.


  • Reverting the commits did not make a difference
  • Upgrading the dependencies also made no difference.


  • I’m using gatsby-source-strava
  • Strava have short-lived tokens only (~ 3 hours).
  • I don’t want to check into the source code the token so added it to the environment variables in Netlify as prescribed in the docs of the plugin.
  • It had expired and somehow in the building of the site it caused it to fail (not sure why).


  • Strava has refresh tokens, but I’m not sure how to extract them. This issue on the repo has a few leads.

hi prabu, welcome.

i don’t have a specific answer for you on how to overcome this error - we’ll have to wait for someone else to chime in, but the problem is undeniably this:

2:38:23 AM: success createSchemaCustomization - 0.210s
2:38:23 AM: error source-strava: Authorization Error
2:38:23 AM: not finished source and transform nodes - 0.535s

Hi Perry,

Thanks for that! I just realised myself. I’ve reached out the plugin author about how to configure this as Strava (the third party) uses refresh tokens and I’ve put mine in the environment variables provided by Netlify.

However, on the next deployment, the tokens are expired and the above happens.

Hi, @prabu, it sounds like you are troubleshooting this with plugin author for now. If there are other questions for Netlify about this issue, please let us know.

Will do. Thanks @luke.