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

Better error message for TypeError: Converting circular structure to JSON #3562

Closed
bgschiller opened this issue Nov 18, 2018 · 1 comment
Closed
Labels
chromium Issues with Puppeteer-Chromium

Comments

@bgschiller
Copy link
Contributor

I was trying to use page.evaluateHandle and kept getting an error: TypeError: Converting circular structure to JSON. Everything I was sending was either Serializable or a JSHandle. Eventually, between reading the source and stepping through in the debugger, I discovered my error. I was passing a JSHandle inside an object as an argument: { scope: JSHandle }.

Would you be open to a patch that caught and re-raised that error, but also logged a warning about "Nesting JSHandles inside objects is not supported"? I would be happy to write it if you think this would be a worthwhile change.

@aslushnikov
Copy link
Contributor

Would you be open to a patch that caught and re-raised that error, but also logged a warning about "Nesting JSHandles inside objects is not supported"? I would be happy to write it if you think this would be a worthwhile change.

@bgschiller Yeah that would be nice. Please go for it!

bgschiller added a commit to bgschiller/puppeteer that referenced this issue Nov 22, 2018
ExecutionContext.evaluateHandle accepts arguments that are either
serializable, or JSHandles. A potential confusion is that it *does not*
accept arguments that *contain* JSHandles.

This patch adds a log message warning when it encounters that situation.

Fixes puppeteer#3562
@aslushnikov aslushnikov added the chromium Issues with Puppeteer-Chromium label Dec 6, 2018
aslushnikov pushed a commit that referenced this issue Jan 14, 2019
ExecutionContext.evaluateHandle accepts arguments that are either
serializable, or JSHandles. A potential confusion is that it *does not*
accept arguments that *contain* JSHandles.

This patch adds a log message warning when it encounters that situation.

Fixes #3562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chromium Issues with Puppeteer-Chromium
Projects
None yet
Development

No branches or pull requests

2 participants