Closed emilwidlund closed 6 years ago
Can you show the full code and the complete stacktrace?
Here's the code with the accessToken stripped out.
const httpstatus = require('http-status');
const EventSearch = require("facebook-events-by-location-core");
const es = new EventSearch();
module.exports = (app, options) => {
const repo = options.repo;
/*
=================================
GET - GET EVENTS
=================================
*/
app.get('/events', (req, res, next) => {
if (req.query.longitude && req.query.latitude) {
es.search({
lat: parseFloat(req.query.latitude),
lng: parseFloat(req.query.longitude),
accessToken: //accessToken
})
.then((events) => {
res.status(httpstatus.OK).json(events);
})
.catch((err) => {
res.status(httpstatus.INTERNAL_SERVER_ERROR).json({errorMessage: 'Something went wrong when searching for nearby events'});
});
} else {
res.status(httpstatus.BAD_REQUEST).json({errorMessage: 'Please specify longitude & latitude coordinates'});
}
});
}
The thing is that I don't get the error object from the Catch-phase. So the TypeError is all that ends up in my console. I've double-checked and it looks like something is wrong within the lib itself.
Slightly off-topic, but why don’t you use https://github.com/tobilg/facebook-events-by-location as you’re apparently trying to build an API service?
Mainly because I have a quite big & complex API already setup, and I found that this repo would be the easiest way to get the functionality in.
After some digging, the problem seems to occur on line 124 in eventSearch.js. That success function never executes.
The most recent commit could have caused some issues. https://github.com/tobilg/facebook-events-by-location-core/commit/25c24434d24fb08fdc0dbf0aab73c25b5ad1c5fe
Version 0.7.0 works fine. Downgrading until issue is fixed.
I actually couldn't find a way to get it to error-ing out... Made some minor tweaks in #23. Tests pass.
New version 0.8.1
has been published to npm. Please check and close accordingly.
Thanks for such a quick solution. 0.8.1 works fine. Closing issue.
I'm getting this error with the following syntax. Anyone know if I've messed something up?
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Converting circular structure to JSON