Improve error handling of invalid JSON in `audits`
See original GitHub issueWhen 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
🎉 This issue has been resolved in version 1.4.2 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀