Converting circular structure to JSON
See original GitHub issueHello 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 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Hi @murilo-campaner, not sure if this is a rest-hapi specific issue, but I remember running into something similar earlier that was related to hapi-swagger. Updating to the latest version of hapi-swagger fixed the issue. If you use rest-hapi v0.27.3 and higher it uses an updated version of hapi-swagger that might help.
@rahil471 I have not set up a project directly using Nginx, however, the project I mentioned above uses Cloudflare to redirect to rest-hapi, and I believe they use Nginx for reverse-proxying.
I will continue to look into this issue, but for now I suggest posting the issue on the hapi-swagger page or browsing their issues.