JKHeadley / JKHeadley/rest-hapi
Converting circular structure to JSON
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 155
- PR merge metrics
- No merged PRs in 30d
Description
Hello everybody.
I'm trying to duplicate my actual production environment to create dev environment in same server.
I already duplicate database and nginx configuration for another domain, but, when I access my dev environment I got the following error:
`Debug: internal, implementation, error
TypeError: Uncaught error: Converting circular structure to JSON
at Object.stringify (native)
at Object.internals.paths.build.internals.paths.buildRoutes.internals.hasFileType (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi-swagger/lib/paths.js:381:28)
at /var/www/dev-api.mydomain.com.br/public/node_modules/hapi-swagger/lib/paths.js:223:23
at Array.forEach (native)
at internals.paths.build.internals.paths.buildRoutes.routes [as buildRoutes] (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi-swagger/lib/paths.js:179:12)
at internals.paths.build.routes.forEach [as build] (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi-swagger/lib/paths.js:151:17)
at Object.builder.getSwaggerJSON (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi-swagger/lib/builder.js:110:26)
at settings.log.plugin.route.config.handler.plugin.methods.getSwaggerJSON.Builder.getSwaggerJSON (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi-swagger/lib/index.js:115:29)
at Object.exports.execute.internals.prerequisites.internals.handler.finalize [as handler] (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi/lib/handler.js:101:51)
at /var/www/dev-api.mydomain.com.br/public/node_modules/hapi/lib/handler.js:32:23
at internals.Protect.run.finish [as run] (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi/lib/protect.js:60:12)
at exports.execute.finalize (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi/lib/handler.js:26:22)
at each (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi/lib/request.js:401:16)
at iterate (/var/www/dev-api.mydomain.com.br/public/node_modules/items/lib/index.js:36:13)
at done (/var/www/dev-api.mydomain.com.br/public/node_modules/items/lib/index.js:28:25)
at module.exports.internals.state.next (/var/www/dev-api.mydomain.com.br/public/node_modules/hapi/lib/route.js:292:16)
`
My production environment is working.
Anyone can help-me with this?
(I have replaced the url of my domain to dev-api.mydomain.com.br for obvious reasons)
Thanks :)
Contributor guide
Research direction
Start with node_modules/hapi-swagger/lib/paths.js, especially hasFileType and buildRoutes, then trace the Swagger generation path through builder.js. Compare the working production configuration with the duplicated development database, nginx, routes, and schemas to identify the value causing circular JSON serialization; done means the development Swagger endpoint generates successfully without the error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100