@sentry/google-cloud-serverless
v8.47.0
Published
Official Sentry SDK for Google Cloud Functions
Downloads
32,131
Keywords
Readme
Official Sentry SDK for Google Cloud Functions
Links
General
This package is a wrapper around @sentry/node
, with added functionality related to various Serverless solutions. All
methods available in @sentry/node
can be imported from @sentry/google-cloud-serverless
.
To use this SDK, call Sentry.init(options)
at the very beginning of your JavaScript file.
const Sentry = require('@sentry/google-cloud-serverless');
Sentry.init({
dsn: '__DSN__',
tracesSampleRate: 1.0,
// ...
});
// For HTTP Functions:
exports.helloHttp = Sentry.wrapHttpFunction((req, res) => {
throw new Error('oh, hello there!');
});
// For Background Functions:
exports.helloEvents = Sentry.wrapEventFunction((data, context, callback) => {
throw new Error('oh, hello there!');
});
// For CloudEvents:
exports.helloEvents = Sentry.wrapCloudEventFunction((context, callback) => {
throw new Error('oh, hello there!');
});