Comments (23)
Serverless 1.12 should be released any time now... Then I can finally try to make this a real plugin again.
from serverless-sentry-plugin.
My plan is to create a serverless plugin that will simplify integration of Sentry with AWS Lambda/Serverless. For example, the plugin should be capable of automatically creating Sentry releases and upload mapping files. This functionality is certainly platform-agnostic and would work the same way for both Python and Node.js (as well as Java). However, when it comes to the details such as monitoring memory utilization, timeouts and unhandled exception handling, the code will have to be platform specific and different implementations for different platforms will be required.
Having that said, the goal for this plugin is to make it easy and straight forward to add additional platforms either by myself or by contributors.
from serverless-sentry-plugin.
Wow, it has been some time since the last update. I've just pushed a first version of the new plugin to master including all documentation. It is not an official release and hasn't been pushed to NPM yet. But if any of you wants to take a look and give some feedback, I'd appreciate it!
from serverless-sentry-plugin.
I'd be interested in porting it, but quite frankly we're still relying on the 0.5 branch internally. Therefore I don't have a timeline for this right now.
from serverless-sentry-plugin.
Do you have any idea what would be involved in porting it?
from serverless-sentry-plugin.
I'd be interested in helping out with this port as well
from serverless-sentry-plugin.
With the latest improvements and plugins for Serverless 1.9.0 we can finally upgrade our own environment from 0.5. This means I will start working on this plugin again and see how we can port it over to the latest platform. No ETA yet, but I wanted to keep you guys updated. Thanks for your support.
from serverless-sentry-plugin.
That's great news Andre.
from serverless-sentry-plugin.
Nice
from serverless-sentry-plugin.
The plugin isn't ready yet as I'm still evaluating what's the best way of hooking Sentry into our Lambda Functions handlers. But here's a Gist for a helper file that is already usable: https://gist.github.com/arabold/1e605ce424033a6b63cc6c6d370b1aef
To use this, put the raven-lambda.js
from the Gist somewhere in your local folder structure and install the latest raven module (npm install --save raven
). You will further need to add new environment variables to your serverless.yaml
:
service: my-serverless-project
provider:
name: aws
runtime: nodejs4.3
stage: dev
region: us-east-1
environment:
SERVERLESS_PROJECT: ${self:service}
SERVERLESS_STAGE: ${opt:stage, self:provider.stage}
SERVERLESS_REGION: ${opt:region, self:provider.region}
SENTRY_DSN: https://xxxx:[email protected]/zzzz
Finally, in your handler.js
do something like this:
const RavenLambdaWrapper = require("./raven-lambda");
const ravenConfig = { /* custom options go here */ };
// Wrap handler for automated error and exception logging
module.exports.handler = RavenLambdaWrapper.handler(ravenConfig, (event, context, callback) => {
// your Lambda Functions Handler code goes here...
});
If any of you has a few minutes and want to give it a shot, let me know your results.
from serverless-sentry-plugin.
Would there be any way of using this with a Python application / Python functions?
from serverless-sentry-plugin.
@flux627 , no unfortunately not. I need my code to hook into the Node-specific callbacks and thus it will only work with Node.js projects. You would have to rewrite the code above (in the Gist) using Python and do something similar.
from serverless-sentry-plugin.
Is / should platform-agnosticism be a goal of this repository? Is there any way of consolidating or refactoring some of the logic to be useful in both implementations, instead of having to maintain two implementations in different languages?
from serverless-sentry-plugin.
Looks like the Raven client isn't initialized because I got:
START RequestId: 2fcaea4d-139d-11e7-b0a4-15b88ac107b6 Version: $LATEST
2017-03-28T09:59:21.645Z 2fcaea4d-139d-11e7-b0a4-15b88ac107b6 [email protected] alert: Enabled automatic breadcrumbs for console
2017-03-28T09:59:21.822Z 2fcaea4d-139d-11e7-b0a4-15b88ac107b6 [email protected] alert: Enabled automatic breadcrumbs for http
2017-03-28T09:59:21.845Z 2fcaea4d-139d-11e7-b0a4-15b88ac107b6 TypeError: Cannot read property 'user' of undefined
at /var/task/handler.js:884:36
And my lambda does nothing.
from serverless-sentry-plugin.
Thanks, @j0k3r . I think this is a stupid bug in my original Gist. I've fixed it. Check the updated script here: https://gist.github.com/arabold/1e605ce424033a6b63cc6c6d370b1aef
I'm currently waiting for the next major update to Serverless which will add a new package command and thus allows plugins too hook into the packaging job before the deployment. This will be necessary for this plugin to inject the necessary logic.
Right now I think this plugin will consist of 2 separate modules:
serverless-sentry-plugin
- The serverless plugin itself which will hook into Serverless' new package command.serverless-sentry-lib
- A node module that contains the wrapped code from the Gist.
To use it you'll have to both install the plugin and the lib, and instrument your code using the RavenLambdaWrapper
as described above. This will give the developer maximum flexibility on when and how to add Sentry handling while minimizing side effects.
from serverless-sentry-plugin.
Thanks !
Works better, at least my lambda is running fine again.
I'll now check for error to see them coming in Sentry.
Also, that line shouldn't be updated.
By new serverless version, you mean 2.0.0?
from serverless-sentry-plugin.
@j0k3r . The line you mentioned is importing the original raven
node module (https://www.npmjs.com/package/raven). It should be correct as the code depends on it! Also, make sure to have it installed as a dependency using npm install --save-dev raven
.
Right now I expect the necessary code changes to become available in Serverless 1.10 later this week. But I'm not sure if they made it in yet or not.
from serverless-sentry-plugin.
Hum, that line import your wrapper not the original raven module.
The original raven module is imported inside your wrapper (using const Raven = require("raven");
)
Anyway, I've tested with some errors and it works fine, thanks!
from serverless-sentry-plugin.
Thank you so much, it almost worked, the exception failed to be sent due to invalid api key, [email protected] alert: failed to send exception to sentry: HTTP Error (401): Invalid api key
. Anyone else has the same problem?
Here's my serverless.yml configuration
environment:
SENTRY_DSN: ${self:custom.config.SENTRY_DSN}
And I keep my sentry key in a separate configuration file.
SENTRY_DSN: "https://[email protected]/id"
from serverless-sentry-plugin.
@j1wu did you have a custom:
line in your serverless.yml configuration file? Because, if you kept your sentry key in a different file, you have to load it in your serverless.yml.
For example:
SENTRY_DSN: ${file(config/serverless-conf.yml):SENTRY_DSN}
This is going to read the attribute SENTRY_DSN
from the file config/serverless-conf.yml
.
from serverless-sentry-plugin.
@j0k3r Hi Jérémy, thanks for your reply, yes, I did, actually, I just tried to hardcode sentry api key, but still I got Invalid api key
error, I'll try to find a way to debug it a bit more.
Raven.config(
// process.env.SENTRY_DSN,
'https://[email protected]/id',
_.extend({...
from serverless-sentry-plugin.
My bad, I was using the wrong SENTRY_DSN url, now, it's reporting exceptions as expected, thanks again! 👍
from serverless-sentry-plugin.
RC1 has been published to npm.
from serverless-sentry-plugin.
Related Issues (20)
- Create release failing on v2.0.0 HOT 2
- Cannot catch unhandled promise rejections HOT 8
- 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.