Skip to content

feat(v9/meta): Unify detection of serverless environments and add Cloud Run #17204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export async function flushIfServerless(): Promise<void> {
const isServerless =
!!process.env.FUNCTIONS_WORKER_RUNTIME || // Azure Functions
!!process.env.LAMBDA_TASK_ROOT || // AWS Lambda
!!process.env.K_SERVICE || // Google Cloud Run
!!process.env.CF_PAGES || // Cloudflare
!!process.env.VERCEL ||
!!process.env.NETLIFY;
Expand Down
8 changes: 7 additions & 1 deletion packages/solidstart/src/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { DEBUG_BUILD } from '../common/debug-build';

/** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */
export async function flushIfServerless(): Promise<void> {
const isServerless = !!process.env.LAMBDA_TASK_ROOT || !!process.env.VERCEL;
const isServerless =
!!process.env.FUNCTIONS_WORKER_RUNTIME || // Azure Functions
!!process.env.LAMBDA_TASK_ROOT || // AWS Lambda
!!process.env.K_SERVICE || // Google Cloud Run
!!process.env.CF_PAGES || // Cloudflare
!!process.env.VERCEL ||
!!process.env.NETLIFY;

if (isServerless) {
try {
Expand Down
10 changes: 8 additions & 2 deletions packages/sveltekit/src/server-common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ export async function flushIfServerless(): Promise<void> {
return;
}

const platformSupportsStreaming = !process.env.LAMBDA_TASK_ROOT && !process.env.VERCEL;
const isServerless =
!!process.env.FUNCTIONS_WORKER_RUNTIME || // Azure Functions
!!process.env.LAMBDA_TASK_ROOT || // AWS Lambda
!!process.env.K_SERVICE || // Google Cloud Run
!!process.env.CF_PAGES || // Cloudflare
!!process.env.VERCEL ||
!!process.env.NETLIFY;

if (!platformSupportsStreaming) {
if (isServerless) {
try {
DEBUG_BUILD && debug.log('Flushing events...');
await flush(2000);
Expand Down
Loading