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

TypeError: Converting circular structure to JSON #9

Open
Konard opened this issue Sep 3, 2024 · 0 comments
Open

TypeError: Converting circular structure to JSON #9

Konard opened this issue Sep 3, 2024 · 0 comments

Comments

@Konard
Copy link
Member

Konard commented Sep 3, 2024

Describe the bug

Handler with code

async (arg) => {
  return arg
}

Rejects with error:

{
  "stack": "TypeError: Converting circular structure to JSON\n    --> starting at object with constructor 'Object'\n    |     property 'Provider' -> object with constructor 'Object'\n    --- property '_context' closes the circle\n    at JSON.stringify (<anonymous>)\n    at stringify (/node_modules/express/lib/response.js:1150:12)\n    at ServerResponse.json (/node_modules/express/lib/response.js:271:14)\n    at file:///index.js:77:13\n    at Generator.next (<anonymous>)\n    at fulfilled (file:///index.js:4:58)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
  "message": "Converting circular structure to JSON\n    --> starting at object with constructor 'Object'\n    |     property 'Provider' -> object with constructor 'Object'\n    --- property '_context' closes the circle"
}

Workaround:
Use util.inspect:

async (arg) => {
  const util = await import('util')
  return util.inspect(arg, {depth: 15})
}

Expected Behavior

Handler to return that json

Current Behavior

Handler rejects with error

Steps to reproduce

No response

Environment

No response


Forked from deep-foundation/js-docker-isolation-provider#10 by https://github.com/konard/gh-org-migrator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant