From 58520c7553b55fbd7f6db2f5b4abd38a6cb93a5b Mon Sep 17 00:00:00 2001 From: Daniel Rochetti Date: Mon, 2 Oct 2023 16:06:54 -0300 Subject: [PATCH] feat(nextjs): allow auth header override (#12) * feat(nextjs): allow auth header override * chore: bump nextjs proxy version to 0.2.3 --- libs/client/src/response.ts | 1 + libs/nextjs/package.json | 2 +- libs/nextjs/src/handler.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/client/src/response.ts b/libs/client/src/response.ts index e972659..b0ee0c7 100644 --- a/libs/client/src/response.ts +++ b/libs/client/src/response.ts @@ -11,6 +11,7 @@ export class ApiError extends Error { public readonly body?: any; constructor({ message, status, body }: ApiErrorArgs) { super(message); + this.name = 'ApiError'; this.status = status; this.body = body; } diff --git a/libs/nextjs/package.json b/libs/nextjs/package.json index 55ead0b..f0be04e 100644 --- a/libs/nextjs/package.json +++ b/libs/nextjs/package.json @@ -1,7 +1,7 @@ { "name": "@fal-ai/serverless-nextjs", "description": "The fal-serverless Next.js integration", - "version": "0.2.2", + "version": "0.2.3", "license": "MIT", "repository": { "type": "git", diff --git a/libs/nextjs/src/handler.ts b/libs/nextjs/src/handler.ts index 007541f..42983a3 100644 --- a/libs/nextjs/src/handler.ts +++ b/libs/nextjs/src/handler.ts @@ -83,7 +83,7 @@ export const handler: NextApiHandler = async (request, response) => { method: request.method, headers: { ...headers, - authorization: `Key ${falKey}`, + authorization: getHeader(request, 'authorization') ?? `Key ${falKey}`, accept: 'application/json', 'content-type': 'application/json', 'x-fal-client-proxy': '@fal-ai/serverless-nextjs',