Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a production Sentry “UnhandledRejection” originating from the CodeMirror JSON linter’s Nunjucks template rendering step, preventing template-render failures from bubbling as unhandled promise rejections.
Changes:
- Wrap the Nunjucks
render()call (and subsequentjsonlint.parse) in a singletry/catchto avoid unhandled rejections during linting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const renderedText: string | null = await render(text, {}); | ||
| if (renderedText) { | ||
| jsonlint.parse(renderedText); | ||
| } catch {} | ||
| } | ||
| } | ||
| } catch {} |
There was a problem hiding this comment.
Catching render() rejections fixes the unhandled promise, but the empty catch also causes the validator to silently return no lint errors when template rendering fails (e.g., undefined variables, syntax errors, or getNunjucks failures). That means invalid JSON can appear “valid” to the linter.
Consider falling back to linting the original text when rendering fails (still wrapped so it can’t throw), and/or call render with ignoreUndefinedEnvVariable: true to avoid rejecting for missing variables during linting.
✅ Circular References ReportGenerated at: 2026-04-08T09:01:42.947Z Summary
Click to view all circular references in PR (62)Click to view all circular references in base branch (62)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
ad19cb3 to
62eb398
Compare
Resolve this sentry error:
https://konghq.sentry.io/issues/7310821007/?environment=production&project=6311804&query=is%3Aunresolved&referrer=issue-stream&sort=freq