web-check
web-check copied to clipboard
fix: handle non-JSON responses in carbon.js to prevent crash
When the WebsiteCarbon API is protected by Cloudflare and requests originate from datacenter IPs, Cloudflare may return an HTML challenge page instead of JSON. This caused JSON.parse() to throw an uncaught SyntaxError exception, crashing the entire application.
This fix:
- Checks if the response starts with HTML markers before parsing
- Wraps JSON.parse in try-catch for additional safety
- Returns a descriptive error message instead of crashing
Fixes #268
Deploy Preview for web-check ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | a163c356b91129a2b9c6233be2f9364398220ee5 |
| Latest deploy log | https://app.netlify.com/projects/web-check/deploys/695fdb25570223000808be85 |
| Deploy Preview | https://deploy-preview-271--web-check.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.