- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.7k
Closed
Labels
Package: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
Description
Maybe it's not a bug, but I'm not sure. because there is no documentation for it.
We are trying to send an attachment of the issue to the sentry via the NodeJS backend application. I wrote the code below by commenting out the API, but it didn't work.
const sentryResponse = Sentry.captureException(err.original);
const client = Sentry.getCurrentHub().getClient();
const { host, path, projectId, port, protocol, user } = client.getDsn();
const endpoint = ${protocol}://${host}${port !== '' ? :${port}: ''}${ path !== '' ?/${path} : '' }/api/${projectId}/events/${sentryResponse}/attachments/?sentry_key=${user}&sentry_version=7&sentry_client=custom-javascript;
fetch(endpoint, {
  method: 'POST',
  body: {
    'variables.file': fs.createReadStream('./README.md')
  },
}).catch((ex) => {
  // we have to catch this otherwise it throws an infinite loop in Sentry
  console.error(ex);
});
} catch (ex) {
console.error(ex);
}
There has to be a simpler way to do this?
Metadata
Metadata
Assignees
Labels
Package: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK