question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve error handling of invalid JSON in `audits`

See original GitHub issue

When the audits inputs contains invalid JSON, the error message is currently:

Unexpected token o in JSON at position 1 
    /opt/build/repo/node_modules/@netlify/plugin-lighthouse/src/config.js:46:19 getConfiguration
    /opt/build/repo/node_modules/@netlify/plugin-lighthouse/src/index.js:214:26 onPostBuild

Adding some try/catch/failBuild block around JSON.parse() could help build a more precise error message.

https://github.com/netlify-labs/netlify-plugin-lighthouse/blob/ca0f50b66ad1531f100cc78202798f46de319868/src/config.js#L46

Bugsnag error

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ehmickycommented, Sep 10, 2020

For information, schema validations on inputs is being drafted at https://github.com/netlify/build/issues/1053, but we never got around to implementing it. I think most of the implementation time will actually be in building the UI for this.

0reactions
erezrokahcommented, Sep 10, 2020

🎉 This issue has been resolved in version 1.4.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the Invalid JSON Error in WordPress? - Rank Math
In this article, learn how to fix the invalid JSON error - 'Updating failed. The response is not a valid JSON response.' with...
Read more >
Error: Invalid JSON (Unexpected " " at position 4 in state STOP ...
we encountered this problem, turns out the CI environment we're running in (travis) was using npm 5.6.0 which didn't support audit yet and...
Read more >
Error handling for invalid JSON submitted - Treehouse
When I POST invalid JSON I don't get the usual error messages, neither 400 nor 500, how do you catch invalid JSON, and...
Read more >
Catching Invalid JSON Parse Errors with Rack Middleware
Rescue the relevant parser error,; Look to see if the client wanted JSON by inspecting their HTTP_ACCEPT header, and; If they want JSON...
Read more >
How can i check for invalid JSON | Layer7 API Management
You can use ${audit.details.last.fullText} to get the last error message. Here is an example -> copy the xml below and paste to an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found