Skip to navigation

Detect the serverless platform by inspecting well-known environment variables. Checks for AWS Lambda (AWS_LAMBDA_FUNCTION_NAME, _HANDLER), Google Cloud Functions (FUNCTION_TARGET, K_SERVICE), Azure Functions (FUNCTIONS_WORKER_RUNTIME, AZURE_FUNCTIONS_ENVIRONMENT), and CGI (GATEWAY_INTERFACE). Defaults to "lambda" if no match is found.

Parameters

None.

Returns

ServerlessPlatform — The detected platform identifier: "lambda", "gcf", "azure", or "cgi".

Example

import { ServerlessAdapter } from '@signalwire/sdk';
const adapter = new ServerlessAdapter();
console.log(adapter.detectPlatform()); // "lambda"