Simple serverless function:
import { VercelRequest, VercelResponse } from '@vercel/node';
import * as Sentry from '@sentry/node';
export default async function functionSentry(
request: VercelRequest,
response: VercelResponse,
) {
Sentry.init({
dsn: 'https://dsn_value@sentry.onpremise.org/66',
environment: process.env.NODE_ENV,
serverName: 'trololo',
release: '0',
debug: false,
// Add Tracing by setting tracesSampleRate
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set sampling rate for profiling
// This is relative to tracesSampleRate
profilesSampleRate: 1.0,
});
Sentry.captureException(new Error('test'));
throw new Error('test2');
}
Calling the corresponding endpoint does not generate any issues in Sentry.
Naturally, the Sentry server works, and if the function is run without Vercel, issues are generated in Sentry.
I assume that Vercel kills the function process after exception as well as after response.send(). But, what to do?