From a716818b87e7462984742bc28ee2ef2c17007735 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 31 Aug 2023 12:54:17 +0100 Subject: [PATCH] fix(@astrojs/vercel): warn user when `functionPerRoute` is `true` --- .changeset/thirty-bees-check.md | 5 +++++ packages/integrations/vercel/src/serverless/adapter.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/thirty-bees-check.md diff --git a/.changeset/thirty-bees-check.md b/.changeset/thirty-bees-check.md new file mode 100644 index 000000000000..f7e2703dea9c --- /dev/null +++ b/.changeset/thirty-bees-check.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Add warning when `functionPerRoute` is set to `true` diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 22c35b87f63a..87308ce2f052 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -129,7 +129,12 @@ export default function vercelServerless({ ...getImageConfig(imageService, imagesConfig, command), }); }, - 'astro:config:done': ({ setAdapter, config }) => { + 'astro:config:done': ({ setAdapter, config, logger }) => { + if (functionPerRoute === true) { + logger.warn( + "The Vercel plans might have limits to the number of functions you can create, make sure to check them if you don't want to incur into additional costs." + ); + } setAdapter(getAdapter({ functionPerRoute, edgeMiddleware })); _config = config; buildTempFolder = config.build.server;