Closed regan-sarwas closed 8 years ago
calling /api/0.6/bug, or any other 'bad' request throws: TypeError: Converting circular structure to JSON<br> at Object.stringify..... I'm not on the network, so I can't test with the production build.
TypeError: Converting circular structure to JSON<br> at Object.stringify.....
The following is what I think is happening: in index.js you add a function to express https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/index.js#L38
The function should have a parameter set like (req,res,next) (see http://expressjs.com/4x/api.html#router.use)
in apiWrapper.js, the function is defined here
https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/src/apiWrapper.js#L292
and then here
https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/src/apiWrapper.js#L249
The first parameter is assumed to be an error object, not a request.
When this function is called by express, err is a express.Request, not an Error, and the following line throws the ugly error in the browser
https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/src/apiWrapper.js#L256
Fixed with commit e021435ddd2a448aea9b8fe7a7170a566acec935
calling /api/0.6/bug, or any other 'bad' request throws:
TypeError: Converting circular structure to JSON<br> at Object.stringify.....
I'm not on the network, so I can't test with the production build.The following is what I think is happening: in index.js you add a function to express https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/index.js#L38
The function should have a parameter set like (req,res,next) (see http://expressjs.com/4x/api.html#router.use)
in apiWrapper.js, the function is defined here
https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/src/apiWrapper.js#L292
and then here
https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/src/apiWrapper.js#L249
The first parameter is assumed to be an error object, not a request.
When this function is called by express, err is a express.Request, not an Error, and the following line throws the ugly error in the browser
https://github.com/nationalparkservice/places-api/blob/d8afcd3d18143f1da000912e945305f0747409bd/src/apiWrapper.js#L256