Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use JSON.stringify for logging purposes #236

Merged

Conversation

kzantow
Copy link
Contributor

@kzantow kzantow commented Apr 5, 2022

There was an error reported during a dependency snapshot upload:

Error: Converting circular structure to JSON
149
    --> starting at object with constructor 'TLSSocket'
150
    |     property '_httpMessage' -> object with constructor 'ClientRequest'
151
    --- property 'socket' closes the circle

I have not been able to reproduce this, but I suspect there was a legitimate error during upload which is getting masked by a circular reference stringifying error, this PR replaces all JSON.stringify calls used for logging with console.log calls.

Signed-off-by: Keith Zantow <kzantow@gmail.com>
@kzantow kzantow requested a review from a team April 5, 2022 16:55
@kzantow kzantow added the bug Something isn't working label Apr 5, 2022
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Copy link

@jonasagx jonasagx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use a linter to spot circular references?

@kzantow
Copy link
Contributor Author

kzantow commented Apr 5, 2022

@jonasagx I don't really think so, these are some structures returned deep within the octokit client.

@kzantow kzantow merged commit f6c3d0f into anchore:main Apr 5, 2022
@kzantow kzantow deleted the logging-error-during-snapshot-upload branch April 5, 2022 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants