Convenience wrapper for Got to interact with the Sentry API
npm i sentry-got
Instead of:
const got = require('got');
const token = 'foo';
(async () => {
const {body} = await got('https://sentry.io/api/0/projects/{organization_slug}/{project_slug}/events/', {
headers: {
'authorization': `Bearer ${token}`,
}
});
console.log(body);
//=> '[]'
})();
You can do:
const sentryGot = require('sentry-got');
(async () => {
const {body} = await sentryGot('projects/{organization_slug}/{project_slug}/events/', {token: 'foo'});
console.log(body.events);
//=> '[]'
})();
or pass SENTRY_ENDPOINT
and SENTRY_TOKEN
as environment variables.