diff --git a/.changeset/forty-impalas-fry.md b/.changeset/forty-impalas-fry.md new file mode 100644 index 000000000..dfc1c5486 --- /dev/null +++ b/.changeset/forty-impalas-fry.md @@ -0,0 +1,5 @@ +--- +"inngest": patch +--- + +Add `INNGEST_API_BASE_URL` and `INNGEST_EVENT_API_BASE_URL`, used for internal testing diff --git a/packages/inngest/etc/inngest.api.md b/packages/inngest/etc/inngest.api.md index cf052d648..375eca40a 100644 --- a/packages/inngest/etc/inngest.api.md +++ b/packages/inngest/etc/inngest.api.md @@ -417,8 +417,8 @@ export type ZodEventSchemas = Record { */ private eventKey = ""; - private readonly baseUrl: string | undefined; + private readonly apiBaseUrl: string | undefined; + private readonly eventBaseUrl: string | undefined; private readonly inngestApi: InngestApi; @@ -162,7 +163,15 @@ export class Inngest { this.id = id; - this.baseUrl = baseUrl || processEnv(envKeys.InngestBaseUrl); + this.apiBaseUrl = + baseUrl || + processEnv(envKeys.InngestApiBaseUrl) || + processEnv(envKeys.InngestBaseUrl); + + this.eventBaseUrl = + baseUrl || + processEnv(envKeys.InngestEventApiBaseUrl) || + processEnv(envKeys.InngestBaseUrl); this.setEventKey(eventKey || processEnv(envKeys.InngestEventKey) || ""); @@ -188,7 +197,7 @@ export class Inngest { this.fetch = getFetch(fetch); this.inngestApi = new InngestApi({ - baseUrl: this.baseUrl || defaultInngestBaseUrl, + baseUrl: this.apiBaseUrl || defaultInngestApiBaseUrl, signingKey: processEnv(envKeys.InngestSigningKey) || "", fetch: this.fetch, }); @@ -294,7 +303,7 @@ export class Inngest { this.sendEventUrl = new URL( `e/${this.eventKey}`, - this.baseUrl || defaultInngestEventBaseUrl + this.eventBaseUrl || defaultInngestEventBaseUrl ); } @@ -413,7 +422,7 @@ export class Inngest { * user has set this it means they have already chosen a URL to hit. */ if (!skipDevServer()) { - if (!this.baseUrl) { + if (!this.eventBaseUrl) { const devAvailable = await devServerAvailable( defaultDevServerHost, this.fetch diff --git a/packages/inngest/src/components/InngestCommHandler.ts b/packages/inngest/src/components/InngestCommHandler.ts index ee9a575e8..589d86027 100644 --- a/packages/inngest/src/components/InngestCommHandler.ts +++ b/packages/inngest/src/components/InngestCommHandler.ts @@ -5,7 +5,7 @@ import { z } from "zod"; import { ServerTiming } from "../helpers/ServerTiming"; import { debugPrefix, - defaultInngestBaseUrl, + defaultInngestApiBaseUrl, envKeys, headerKeys, logPrefix, @@ -390,9 +390,10 @@ export class InngestCommHandler< this.inngestRegisterUrl = new URL( "/fn/register", options.baseUrl || + this.env[envKeys.InngestApiBaseUrl] || this.env[envKeys.InngestBaseUrl] || - this.client["baseUrl"] || - defaultInngestBaseUrl + this.client["apiBaseUrl"] || + defaultInngestApiBaseUrl ); this.signingKey = options.signingKey; @@ -1097,13 +1098,6 @@ export class InngestCommHandler< `Use of ${envKeys.InngestDevServerUrl} has been deprecated in v3; please use ${envKeys.InngestBaseUrl} instead. See https://www.inngest.com/docs/sdk/migration` ); } - - if (this.env[envKeys.InngestApiBaseUrl]) { - this.log( - "warn", - `Use of ${envKeys.InngestApiBaseUrl} has been deprecated in v3; please use ${envKeys.InngestBaseUrl} instead. See https://www.inngest.com/docs/sdk/migration` - ); - } } protected validateSignature(sig: string | undefined, body: unknown) { diff --git a/packages/inngest/src/helpers/consts.ts b/packages/inngest/src/helpers/consts.ts index ddf02dcbb..f8502d831 100644 --- a/packages/inngest/src/helpers/consts.ts +++ b/packages/inngest/src/helpers/consts.ts @@ -25,6 +25,8 @@ export enum envKeys { InngestDevServerUrl = "INNGEST_DEVSERVER_URL", InngestEnvironment = "INNGEST_ENV", InngestBaseUrl = "INNGEST_BASE_URL", + InngestEventApiBaseUrl = "INNGEST_EVENT_API_BASE_URL", + InngestApiBaseUrl = "INNGEST_API_BASE_URL", InngestServeHost = "INNGEST_SERVE_HOST", InngestServePath = "INNGEST_SERVE_PATH", InngestLogLevel = "INNGEST_LOG_LEVEL", @@ -32,11 +34,6 @@ export enum envKeys { BranchName = "BRANCH_NAME", - /** - * @deprecated Removed in v3. Use {@link InngestBaseUrl} instead. - */ - InngestApiBaseUrl = "INNGEST_API_BASE_URL", - /** * The git branch of the commit the deployment was triggered by. Example: * `improve-about-page`. @@ -126,7 +123,7 @@ export enum headerKeys { RetryAfter = "retry-after", } -export const defaultInngestBaseUrl = "https://api.inngest.com/"; +export const defaultInngestApiBaseUrl = "https://api.inngest.com/"; export const defaultInngestEventBaseUrl = "https://inn.gs/"; export const defaultDevServerHost = "http://127.0.0.1:8288/"; diff --git a/packages/inngest/src/types.ts b/packages/inngest/src/types.ts index 06262a0fd..4e86b2376 100644 --- a/packages/inngest/src/types.ts +++ b/packages/inngest/src/types.ts @@ -716,7 +716,10 @@ export interface FunctionOptions< * * Specifying just a number means specifying only the concurrency limit. */ - concurrency?: number | ConcurrencyOption | [ConcurrencyOption, ConcurrencyOption]; + concurrency?: + | number + | ConcurrencyOption + | [ConcurrencyOption, ConcurrencyOption]; /** * batchEvents specifies the batch configuration on when this function