fix: replace console.log with debug logger in createValidateStatusCode#829
Open
Juan Ibiapina (juanibiapina-ctfl) wants to merge 3 commits into
Open
fix: replace console.log with debug logger in createValidateStatusCode#829Juan Ibiapina (juanibiapina-ctfl) wants to merge 3 commits into
Juan Ibiapina (juanibiapina-ctfl) wants to merge 3 commits into
Conversation
|
|
||
| export const createValidateStatusCode = (allowedStatusCodes: number[]) => (response: Response) => { | ||
| if (!allowedStatusCodes.includes(response.statusCode)) { | ||
| console.log(response.body) |
There was a problem hiding this comment.
debug might be better here instead of removing it completely
There was a problem hiding this comment.
good idea
Use the package's existing debug logger (gated by DEBUG=@contentful/node-apps-toolkit*) instead of console.log, so the output is silent by default in production.
khaalid subaan (Khaalidsub)
approved these changes
Jun 3, 2026
|
Do we have a ticket for this we could add to the title for context? |
BobHemphill76
approved these changes
Jun 3, 2026
Contributor
BobHemphill76
left a comment
There was a problem hiding this comment.
Just want to make sure that this commit gets tied to a ticket, but otherwise looks good
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
createValidateStatusCodeunconditionally called console.log(response.body) before throwing HTTPError on any unexpected status code. This bypasses any structured logger in the consuming application and writes raw JSON directly to stdout.In Grafana/Loki environments each line of the JSON body is ingested as a separate log entry at error level with no extractable message field, causing significant observability noise (e.g. 550k+ entries/month from 404s on deleted app installations in our Grafana).
Following review feedback, the console.log is replaced with the package's existing debug logger, gated behind
DEBUG=@contentful/node-apps-toolkit*. This means it is silent by default in production but available for local debugging when needed.This change also adds the first unit tests for
createValidateStatusCode, including an explicit assertion that no stdout output occurs when the error path fires.