Skip to content

Commit b720e15

Browse files
authored
fix(nuxt): Detect Azure Function runtime for flushing with timeout (#15288)
The debugging ability for Azure Functions when using Azure Static Web Apps is very limited. But as I could see some Sentry-related logs I **think** Sentry is generally initialized. However, server-related logs don't show up in Sentry. This is **probably** because the Azure Function finishes before the error can be sent to Sentry. By adding the Azure environment variable to check whether we should flush with a timeout, this should possibly fix the issue. Logs in Application Insights: ![image](https://github.com/user-attachments/assets/ed5ccd37-be87-4338-946b-94ec543e08c5)
1 parent 1e4362e commit b720e15

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/nuxt/src/runtime/plugins/sentry.server.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ export default defineNitroPlugin(nitroApp => {
5252
});
5353

5454
async function flushIfServerless(): Promise<void> {
55-
const isServerless = !!process.env.LAMBDA_TASK_ROOT || !!process.env.VERCEL || !!process.env.NETLIFY;
55+
const isServerless =
56+
!!process.env.FUNCTIONS_WORKER_RUNTIME || // Azure Functions
57+
!!process.env.LAMBDA_TASK_ROOT || // AWS Lambda
58+
!!process.env.VERCEL ||
59+
!!process.env.NETLIFY;
5660

5761
// @ts-expect-error This is not typed
5862
if (GLOBAL_OBJ[Symbol.for('@vercel/request-context')]) {

0 commit comments

Comments
 (0)