Comments (8)
Thanks for reporting and providing an example. Indeed I'm able to reproduce this issue now and will release a fix shortly.
from serverless-sentry-plugin.
Thanks for the report. I haven't used serverless-http
myself. Possibly another component overwrites the unhandled rejection handler. Do you have a minimal example that reproduces the issue?
from serverless-sentry-plugin.
@arabold Hey, sorry for the delay! Been a bit busy.
Here's a reproduction: https://github.com/ffxsam/repro-err-handling
When I deploy this to AWS and curl
the API endpoint, I get this response:
{"message": "Internal server error"}
But there are no error reports in Sentry.
from serverless-sentry-plugin.
(don't forget to change the DSN in serverless.yml
)
from serverless-sentry-plugin.
@arabold No way.. awesome! Thanks, I really appreciate that!
from serverless-sentry-plugin.
Promises can get tricky when they're several levels deep. I'm very curious to see the solution to this problem.
from serverless-sentry-plugin.
I have published v2.3.0 of the serverless-sentry-lib
. An update to the plugin is not necessary, just the lib. This should fix the reporting of both unhandled rejections and uncaught exceptions.
The lib handles two cases now (based on your serverless-http
example):
// Throw an unhandled rejection
router.get("/test1", (req, res) => {
new Promise((resolve, reject) => {
reject("Reject this!");
});
res.json({ success: true });
});
// Throw an uncaught exception
router.get("/test2", function (req, res, next) {
setImmediate(() => {
throw new Error("Catch this!");
});
res.json({ success: true });
});
There's a third case that is handled by Express automatically. You can register a custom error handling middleware that forwards errors to Sentry in this case as well:
router.get("/test2", async (req, res) => {
throw new Error("Catch this!");
res.json({
success: true,
});
});
router.use(function (err, req, res, next) {
Sentry.captureException(err);
res.json({ message: error.message });
});
Hope this solves all issues for you. Please let me know if you encounter anything else!
from serverless-sentry-plugin.
Amazing, thank you!
from serverless-sentry-plugin.
Related Issues (20)
- Create release failing on v2.0.0 HOT 2
- Add support for filtering events HOT 1
- READ.me file needs to be modified
- Any progress on uploading source maps? HOT 2
- Differences between this and official @sentry/serverless package HOT 2
- Add enable config
- Missing schema for `functions[].sentry` properties
- Serverless deployment fails with "fatal: No names found, cannot describe anything." HOT 23
- Plugin defines a validation schema that is invalid HOT 12
- Sentry: Error uploading sourcemap file - Error: connect EADDRNOTAVAIL 35.188.42.15:443 - Local HOT 27
- Repository name capturing from remote is wrong HOT 4
- Uploading source map doesn't work when deploying function only HOT 1
- Function Timeouts lack of information HOT 2
- Data scrubbing/Trace sampling feature request HOT 1
- [bug] [regression] Error: Sentry: Error deploying release - Error: Too Many Requests HOT 4
- Add support for @sentry/node v7
- enable CaptureConsole as an option
- Uploading source maps to sentry when using serverless-plugin-typescript
- Add Custom Tags
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-sentry-plugin.