-
Notifications
You must be signed in to change notification settings - Fork 63
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
no notifications with sailsJs + docker #825
Comments
Will take a look. @atex21 what version of Sails and Node.js are you using? |
(Also, is this exclusively within Docker? Were you able to test with Docker?) @subzero10 you said you were able to reproduce this; was it in Docker or outside? I don't really think this is a Docker thing, but I guess we should be sure. My initial exploration:
Not yet verified, but I suspect this has something to do with async. I'll do further investigations later. |
Hi @shalvah! |
@atex21 what does your controller where the error is thrown look like? |
hey @shalvah !
and what happened is that sails response serverError is "activated" and if I have a Honeybadger.notify / notifyAsync there I have the errors mentioned |
What do you mean by |
Also, did you call Honeybadger.configure before trying to call notify? It looks like this should be fairly straightforward to fix, but the Sails docs are terrible on error handling, so that's probably how this scenario was missed in the first place. |
Yes, it's a file that can be configured in sails to answer to res.serverError() , the file is And yes, I do the config of honeybadger at the "beggining", in config/http.js as described in honeybadger docs |
Still can't reproduce. This is working for me: serverError.js: const Honeybadger = require('@honeybadger-io/js');
module.exports = function serverError(optionalData) {
Honeybadger.notify(optionalData);
var req = this.req;
var res = this.res;
if (_.isError(optionalData)) {
sails.log.info('Custom response `res.serverError()` called with an Error:', optionalData);
return res.status(400).send(optionalData.stack);
}
}; The handler: module.exports = {
fn: function (req, res) {
e = new Error("BAD THINGS");
throw e;
return {};
}
}; What am I missing? Also, I just noticed you have two exceptions raised. Are they for the different versions of Honeybadger? Because that first one doesn't seem related. |
@shalvah are you using docker too? 🤔 And in your example did you put honeybadger configuration in http.js? The different exceptions I mentioned first are related to two versions of honeybadger, yes. |
I didn't use Docker. What I was able to reproduce is the fact that i couldn't make the integration work as described in the documentation. But you already confirmed that too. |
@afilipa okay, you've definitely got something weird going on here. Your error is occurring during the I also see you're using ts-node, which may be another cause of troubles itself. But I can't be sure. Also, are you using Also, can you upload a basic repo for reproduction? Or at least share full versions of the relevant files (routes, http, controller, serverError). |
Also: it seems the middleware approach does work, but only for async errors. (You can see this by throwing asynchronously in your controller: |
Oops. I meant @atex21. Or whoever is having the issue. |
Hi @shalvah! Regarding the import of honeybadger, I'm using the
No prob 😛, afilipa was me too, just used personal account because it was weekend and I didn't have company account 😉 |
Also, please include your New Relic setup in your reproduction (minus sensitive data, of course). I strongly suspect that's the culprit here. |
Hi @shalvah ! The new relic info is basically:
But as you suggested before I had removed the require to newrelic and it didn't work too |
Sorry to make another request, but please share the stack trace with New Relic disabled. Still trying to understand why it's trying to call the uncaught exception handler. Maybe another error is being thrown? 🤔 |
Hi @shalvah! My debug without new relic seems to enter in a loop that breaks docker.. but in order to capture some logs I broke the loop and what I have is: my console.logs are in in hope to find something with your help, thank you! |
@atex21 looks like these are logs for v3. Let's focus on v4, please. 🙏 |
Oh never mind. Looks like these are v4, but the error seems to be the first one you posted (which was v3) |
Thanks, this is very helpful. Could you add a |
it prints:
|
@shalvah I forget to mention that the logs I sent you are related to direct call to Honeybadger.notify with no use of middleware. Updating the code as you mentioned in updated doc, middleware + use of errorHandler call, I have: |
Hey @shalvah & @subzero10 ! after this try I had a new error, but the loop was gone!
what also didn't make sense to me.. why was it trying to do something to 127.0.0.1 (?) well, I had changed the code to have:
but it seems
So, given that changes were in file Please let me know how can we do it? |
Found the problem.
This behaviour was fixed in 2019, so upgrading |
Hi @shalvah ! So, since you opened a PR with the workaround change in your side, which is the timeline to have it available to use (approximately 😅)? Again, thanks a lot for your assistance! |
Just need a review from @subzero10 or @joshuap, and then I can merge and see about publishing a release. |
Hey @subzero10 ! So, probably it would be needed a little more investigation regarding middleware use with sails 🤔 |
Good point. That error only occurs because the original report sending crashed, leading to the uncaughtException handler being called. At that point, we've switched the store to the AsyncStore, which only works if it's inside a |
Oh, that's an edgy scenario! Now it makes sense! |
Hey @atex21, this is fixed with |
Thank you @subzero10 & @shalvah for your efforts here! |
Discussed in #824
Originally posted by atex21 July 5, 2022
Hey!
I'm trying to test honeybadger but it's being impossible.. I'm with sailsJS and docker, configurations as described in documentation:
variables arrive well to the container in docker.
In a first hand I realized that that configuration about middleware doesn't work.. If I just throw an exception there is no try to send honeybadger notification, the errorHandler is not called =/
In the other hand, if I forgot the last point and use an explicit HoneyBadger.notify, then there is a try to send notification, however I'm stuck with errors coming for no reason =/, namely
a bit more detail:
Can you help please?
Thank you in advance.
The text was updated successfully, but these errors were encountered: