Skip to content

@sveltejs/adapter-vercel gets stuck in vercel CI (Exceeds the maximum size limit of 300mb) #13764

@snorreks

Description

@snorreks

Describe the bug

When using @sveltejs/adapter-vercel it get stuck on Using @sveltejs/adapter-vercel in CI deployment:

...
✓ built in 19.18s
Run npm run preview to preview your production build locally.
> Using @sveltejs/adapter-vercel

After >15min it throws
The Serverless Function "![-]/0" is 545.09mb which exceeds the maximum size limit of 300mb.

I have used @sveltejs/adapter-vercel version 5.1.0 for over half a year and it worked then, now when I got back to the project and needed to fix a critical bug I can no longer deploy. I updated the version to 5.7.1, still the same issue. I tried with another adapter and that works. I am using nx and pnpm.

Reproduction

  1. Install any version of @sveltejs/adapter-vercel
  2. Build either on vercel CI
  3. See that it get stuck in building process

Logs

[17:07:25.717] Running build in Washington, D.C., USA (East) – iad1
[17:07:25.732] Cloning github.com/Onboardr/onboardr (Branch: master, Commit: 4e3de20)
[17:07:25.880] Previous build caches not available
[17:07:26.805] Cloning completed: 1.073s
[17:07:27.492] Running "cd ../../../.. && bash pipelines/vercel-ignore-build-step.sh"
[17:07:27.713] VERCEL_GIT_COMMIT_REF: master
[17:07:27.714] VERCEL_ENV: production
[17:07:27.714] DISABLE_PREVIEW: 
[17:07:27.714] DISABLE_BUILD: 
[17:07:27.714] SKIP_CHECK: 1
[17:07:27.714] Skipping check
[17:07:27.714] 
[17:07:27.944] Running "vercel build"
[17:07:28.335] Vercel CLI 41.7.0
[17:07:28.447] > Detected Nx. Adjusting default settings...
[17:07:28.957] Detected `pnpm-lock.yaml` version 6 generated by pnpm@8.x
[17:07:28.958] Running "install" command: `cd ../../../.. && pnpm i`...
[17:07:29.595] Lockfile is up to date, resolution step is skipped
[17:07:29.836] Progress: resolved 1, reused 0, downloaded 0, added 0
[17:07:30.191] Packages: +2735
[17:07:30.191] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[17:07:30.845] Progress: resolved 2735, reused 0, downloaded 24, added 13
...
[17:07:48.248] Progress: resolved 2735, reused 0, downloaded 2730, added 2735, done
[17:07:49.263] .../node_modules/@firebase/util postinstall$ node ./postinstall.js
[17:07:49.264] .../node_modules/protobufjs postinstall$ node scripts/postinstall
[17:07:49.303] .../core-js@3.42.0/node_modules/core-js postinstall$ node -e "try{require('./postinstall')}catch(e){}"
[17:07:49.330] .../node_modules/@firebase/util postinstall: Done
[17:07:49.334] .../node_modules/protobufjs postinstall: Done
[17:07:49.354] .../core-js@3.42.0/node_modules/core-js postinstall: Done
[17:07:49.880] .../node_modules/@swc/core postinstall$ node postinstall.js
...
[17:08:30.751] �[32m✓ built in 19.18s�[39m
[17:08:30.751] Run �[1m�[36mnpm run preview�[22m�[39m to preview your production build locally.
[17:08:30.754] �[1m�[36m
[17:08:30.754] > Using @sveltejs/adapter-vercel�[22m�[39m

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 6.99 GB / 15.84 GB
  Binaries:
    Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.2 - ~\AppData\Roaming\npm\pnpm.CMD
    bun: 1.1.15 - ~\AppData\Roaming\npm\bun.CMD
  Browsers:
    Edge: Chromium (133.0.3065.59)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @sveltejs/adapter-vercel: ^5.7.1 => 5.7.1
    @sveltejs/kit: ^2.5.0 => 2.20.8
    @sveltejs/vite-plugin-svelte: ^3.0.2 => 3.1.2
    svelte: ^4.2.9 => 4.2.19
    vite: ^6.3.4 => 6.3.4

Severity

blocking all usage of SvelteKit

Additional Information

package.json
{
	"name": "onboardr",
	"private": true,
	"type": "module",
	"browserslist": [
		">0.2%",
		"not dead",
		"not ie <= 11",
		"not op_mini all"
	],
	"scripts": {
		"affected": "nx affected",
		"affected:apps": "nx affected:apps",
		"affected:build": "nx affected:build",
		"affected:build-ci": "nx affected --target=build-ci",
		"affected:dep-graph": "nx affected:dep-graph",
		"affected:lint": "nx workspace-lint && nx affected --target=stylelint && nx affected:lint",
		"affected:lint-ci": "nx workspace-lint && nx affected --target=stylelint-ci && nx affected --target=lint-ci",
		"affected:test": "nx affected:test --watch=false --browsers Chromium",
		"affected:test-ci": "nx affected:test --code-coverage --watch=false --browsers ChromiumNoSandbox",
		"e2e": "nx e2e $APP",
		"e2e:no-serve": "nx e2e $APP --configuration=no-serve",
		"e2e:only-tag": "TAGS=@only npm run e2e:no-serve --retry=0",
		"dep-graph": "nx dep-graph",
		"format": "DISABLE_V8_COMPILE_CACHE=1 nx format:write",
		"format:check": "nx format:check",
		"format:write": "nx format:write",
		"format:write:all": "prettier --write \"**/*.{svelte,ts}\"",
		"lint": "nx run-many --all --target=lint --exclude=mailvideo-pwa,mailvideo-share,mailvideo-admin,mailvideo-chrome",
		"lint:localekey": "nx run-many --all --target=lint --projects=tag:scope:localekey --exclude=localekey-pwa",
		"lint:mailvideo": "nx run-many --all --target=lint --projects=tag:scope:mailvideo --exclude=mailvideo-pwa,mailvideo-share,mailvideo-admin,mailvideo-chrome",
		"lint:all": "nx run-many --all --target=lint",
		"validate": "nx run-many --all --target=validate",
		"validate:localekey": "nx run-many --projects=tag:scope:localekey --target=validate",
		"validate:mailvideo": "nx run-many --projects=tag:scope:mailvideo --target=validate",
		"nx": "nx",
		"start": "nx serve $APP",
		"test": "nx test $APP --code-coverage --browsers Chromium",
		"update": "nx migrate latest",
		"workspace-generator": "nx workspace-generator",
		"storybook": "pnpm nx storybook shared-frontend-storybook",
		"storybook:test": "pnpm nx build:test shared-frontend-storybook",
		"storybook:build": "pnpm nx build:storybook shared-frontend-storybook",
		"storybook:deploy": "chromatic --project-token=30e95e325c51 -b storybook:build -o dist/storybook",
		"storybook:deploy:skip-tests": "pnpm storybook:deploy --skip",
		"preinstall": "npx only-allow pnpm",
		"analyze": "npx cloc --exclude-dir=node_modules,dist,package.json,pnpm-lock.yaml,.svelte-kit,tmp,.vercel .",
		"postinstall": "patch-package"
	},
	"devDependencies": {
		"@astrojs/sitemap": "^3.0.5",
		"@astrojs/tailwind": "^5.1.0",
		"@astrojs/vercel": "^7.0.2",
		"@aws-sdk/middleware-signing": "^3.502.0",
		"@commitlint/cli": "^18.6.0",
		"@commitlint/config-conventional": "^18.6.0",
		"@crxjs/vite-plugin": "2.0.0-beta.18",
		"@faker-js/faker": "^8.4.0",
		"@firebase/app-compat": "^0.2.26",
		"@firebase/auth": "^1.5.1",
		"@firebase/auth-compat": "^0.5.1",
		"@firebase/auth-types": "^0.12.0",
		"@firebase/rules-unit-testing": "^3.0.1",
		"@fontsource-variable/inter": "^5.0.16",
		"@google-cloud/firestore": "^7.2.0",
		"@nrwl/nx-cloud": "^16.5.2",
		"@nx/devkit": "^17.3.0",
		"@nx/eslint-plugin": "^17.3.0",
		"@nx/js": "^17.3.0",
		"@nx/linter": "^17.3.0",
		"@nx/node": "^17.3.0",
		"@nx/storybook": "^17.3.0",
		"@nx/workspace": "^17.3.0",
		"@originjs/vite-plugin-commonjs": "^1.0.3",
		"@sentry/cli": "2.22.2",
		"@sentry/node": "^7.98.0",
		"@sentry/serverless": "^7.98.0",
		"@sentry/sveltekit": "^7.98.0",
		"@sentry/types": "^7.98.0",
		"@storybook/addon-essentials": "8.0.0-alpha.9",
		"@storybook/addon-interactions": "8.0.0-alpha.9",
		"@storybook/jest": "^0.2.3",
		"@storybook/manager-api": "8.0.0-alpha.9",
		"@storybook/svelte": "8.0.0-alpha.9",
		"@storybook/svelte-vite": "8.0.0-alpha.9",
		"@storybook/test-runner": "^0.16.0",
		"@storybook/testing-library": "^0.2.2",
		"@storybook/theming": "8.0.0-alpha.9",
		"@storybook/types": "8.0.0-alpha.9",
		"@sveltejs/kit": "^2.5.0",
		"@sveltejs/vite-plugin-svelte": "^3.0.2",
		"@swc/core": "^1.3.107",
		"@testing-library/dom": "^9.3.4",
		"@testing-library/svelte": "^4.1.0",
		"@types/aws-lambda": "^8.10.133",
		"@types/chrome": "^0.0.259",
		"@types/common-tags": "^1.8.4",
		"@types/cookie": "^0.6.0",
		"@types/cross-spawn": "^6.0.6",
		"@types/eslint": "^8.56.2",
		"@types/file-saver": "^2.0.7",
		"@types/fluent-ffmpeg": "^2.1.24",
		"@types/fs-extra": "^11.0.4",
		"@types/humanize-duration": "^3.27.4",
		"@types/intercom-web": "^2.8.24",
		"@types/jsonwebtoken": "^9.0.5",
		"@types/node": "^20.11.10",
		"@types/w3c-image-capture": "^1.0.10",
		"@typescript-eslint/eslint-plugin": "^6.20.0",
		"@typescript-eslint/parser": "^6.20.0",
		"@typescript-eslint/typescript-estree": "^6.20.0",
		"@vavite/node-loader": "^4.0.2",
		"@vite-pwa/sveltekit": "^0.3.0",
		"astro": "^4.2.6",
		"astro-icon": "^1.0.4",
		"astro-navbar": "^2.3.0",
		"astro-seo": "^0.8.0",
		"astro-windi": "^0.0.2",
		"autoprefixer": "^10.4.17",
		"chromatic": "^10.6.1",
		"commitizen": "^4.3.0",
		"cookie": "^0.6.0",
		"core-js": "^3.35.1",
		"cross-env": "^7.0.3",
		"cz-customizable": "^7.0.0",
		"dotenv": "^16.4.1",
		"esbuild": "^0.20.0",
		"esbuild-plugin-alias": "^0.2.1",
		"eslint": "^8.56.0",
		"eslint-config-google": "^0.14.0",
		"eslint-config-prettier": "^9.1.0",
		"eslint-import-resolver-node": "^0.3.9",
		"eslint-plugin-import": "^2.29.1",
		"eslint-plugin-no-floating-promise": "^1.0.2",
		"eslint-plugin-prettier": "^5.1.3",
		"eslint-plugin-sort": "^2.11.0",
		"eslint-plugin-sort-class-members": "^1.19.0",
		"eslint-plugin-storybook": "^0.6.15",
		"eslint-plugin-svelte": "^2.35.1",
		"firebase-functions-test": "^3.1.1",
		"firebase-tools": "^13.1.0",
		"fs-extra": "^11.2.0",
		"hubspot": "^2.3.14",
		"jest": "^29.7.0",
		"jest-mock": "^29.7.0",
		"jsdom": "^24.0.0",
		"lefthook": "^1.6.1",
		"libphonenumber-js": "^1.10.54",
		"localekey": "^0.0.3",
		"nx": "^17.3.0",
		"nx-cloud": "^16.5.2",
		"nx-cloud-functions-deployer": "^2.5.4",
		"nx-vercel-utils": "^0.1.0",
		"patch-package": "^8.0.0",
		"prettier": "^3.2.4",
		"prettier-plugin-jsdoc": "^1.3.0",
		"prettier-plugin-svelte": "^3.1.2",
		"prettier-plugin-tailwindcss": "^0.5.11",
		"react": "^18.2.0",
		"react-dom": "^18.2.0",
		"rollup-plugin-visualizer": "^5.12.0",
		"sass": "^1.70.0",
		"sharp": "^0.33.2",
		"storybook": "8.0.0-alpha.9",
		"style-loader": "^3.3.4",
		"stylelint": "^16.2.0",
		"stylelint-checkstyle-formatter": "^0.1.2",
		"stylelint-config-prettier": "^9.0.5",
		"stylelint-config-standard": "^36.0.0",
		"stylelint-order": "^6.0.4",
		"svelte": "^4.2.9",
		"svelte-check": "^3.6.3",
		"svelte-preprocess": "^5.1.3",
		"tslib": "^2.6.2",
		"tsup": "^8.0.1",
		"tsx": "^4.7.0",
		"typescript": "^5.3.3",
		"vercel": "^33.4.0",
		"vite": "^6.3.4",
		"vite-plugin-iso-import": "^1.1.0",
		"vite-plugin-pwa": "^0.17.5",
		"vite-plugin-windicss": "^1.9.3",
		"vite-tsconfig-paths": "^4.3.1",
		"vitest": "^1.2.2",
		"windicss": "^3.5.6",
		"windicss-analysis": "^0.3.5",
		"workbox-core": "^7.0.0",
		"workbox-precaching": "^7.0.0",
		"workbox-window": "^7.0.0",
		"xhr-shim": "^0.1.3"
	},
	"dependencies": {
		"@aws-sdk/client-lambda": "^3.502.0",
		"@aws-sdk/client-s3": "^3.502.0",
		"@aws-sdk/lib-storage": "^3.502.0",
		"@aws-sdk/s3-request-presigner": "^3.502.0",
		"@sentry/integrations": "^7.98.0",
		"@sentry/svelte": "^7.98.0",
		"@slack/webhook": "^7.0.2",
		"@stripe/stripe-js": "^2.4.0",
		"@sveltejs/adapter-vercel": "^5.7.1",
		"axios": "^1.6.7",
		"clsx": "^2.1.0",
		"color2k": "^2.0.3",
		"common-tags": "^1.8.2",
		"country-region-data": "^3.0.0",
		"cropperjs": "^1.6.1",
		"date-picker-svelte": "^2.10.1",
		"dayjs": "^1.11.10",
		"detect-browser": "^5.3.0",
		"device-detector-js": "^3.0.3",
		"exceljs": "^4.4.0",
		"fast-fuzzy": "^1.12.0",
		"fast-safe-stringify": "^2.1.1",
		"file-saver": "^2.0.5",
		"firebase": "^10.7.2",
		"firebase-admin": "^12.0.0",
		"firebase-functions": "^4.6.0",
		"fluent-ffmpeg": "^2.1.2",
		"gpt3-tokenizer": "^1.1.5",
		"humanize-duration": "^3.31.0",
		"idb-keyval": "^6.2.1",
		"isbot": "^4.4.0",
		"jsonwebtoken": "^9.0.2",
		"jszip": "^3.10.1",
		"jwks-rsa": "^3.1.0",
		"meilisearch": "^0.37.0",
		"openai": "^4.26.0",
		"postmark": "^4.0.2",
		"stripe": "^14.14.0",
		"svelte-tel-input": "^3.3.9",
		"tailwindcss-themeable": "^1.3.0",
		"typesafe-i18n": "^5.26.2",
		"wavesurfer.js": "7.5.7",
		"webm-duration-fix": "^1.0.4",
		"winston": "^3.11.0",
		"zod": "^3.22.4"
	},
	"packageManager": "pnpm@8.6.2",
	"config": {
		"commitizen": {
			"path": "./node_modules/cz-customizable"
		},
		"cz-customizable": {
			"config": "cz-config.cjs"
		}
	}
}
svelte.config.js
import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-vercel';
import { dirname, resolve, join } from 'node:path';
import { fileURLToPath } from 'node:url';

const projectDirectory = dirname(fileURLToPath(import.meta.url));
const libsDirectory = resolve(projectDirectory, '../../../../libs');
/**
 * Get the absolute path from the root directory
 *
 * @param {string} path Relative path
 * @returns {string} Absolute path
 */
const toLibPath = (path) => join(libsDirectory, path);
/**
 * Get the absolute path from the src folder in the project directory
 *
 * @param {string} path Relative path
 * @returns {string} Absolute path
 */
const toSrcPath = (path) => join(projectDirectory, 'src', path);

/** @type {import('@sveltejs/kit').Config} */
const config = {
	kit: {
		adapter: adapter({
			// https://vercel.com/templates/svelte/sveltekit-edge-functions
			// edge: process.env.ENABLE_VC_BUILD === '1',
			// runtime: 'nodejs20.x',
		}),
		alias: {
			'$views/*': toSrcPath('lib/views'),
			'$components/*': toSrcPath('lib/components'),
			$i18n: toLibPath('mailvideo/frontend/i18n/src'),
			'$i18n/*': toLibPath('mailvideo/frontend/i18n/src'),
			$lib: toLibPath('lib'),
			'$lib/*': toSrcPath('lib'),
			$types: toSrcPath('lib/types'),
			$utils: toSrcPath('lib/utils'),
			'$utils/*': toSrcPath('lib/utils'),
			'@mailvideo/backend/admin/*': toLibPath(
				'mailvideo/backend/admin/src',
			),
			'@mailvideo/backend/ai/*': toLibPath('mailvideo/backend/ai/src'),
			'@mailvideo/backend/auth/*': toLibPath(
				'mailvideo/backend/auth/src',
			),
			'@mailvideo/backend/aws/*': toLibPath('mailvideo/backend/aws/src'),
			'@mailvideo/backend/configs/*': toLibPath(
				'mailvideo/backend/configs/src',
			),
			'@mailvideo/backend/crm/*': toLibPath('mailvideo/backend/crm/src'),
			'@mailvideo/backend/database/*': toLibPath(
				'mailvideo/backend/database/src',
			),
			'@mailvideo/backend/search/*': toLibPath(
				'mailvideo/backend/search/src',
			),
			'@mailvideo/backend/stripe/*': toLibPath(
				'mailvideo/backend/stripe/src',
			),
			'@mailvideo/backend/svelte-kit/*': toLibPath(
				'mailvideo/backend/svelte-kit/src',
			),
			'@mailvideo/backend/team/*': toLibPath(
				'mailvideo/backend/team/src',
			),
			'@mailvideo/backend/utils/*': toLibPath(
				'mailvideo/backend/utils/src',
			),
			'@mailvideo/backend/video/thumbnail/*': toLibPath(
				'mailvideo/backend/video/thumbnail/src',
			),
			'@mailvideo/backend/video/upload/*': toLibPath(
				'mailvideo/backend/video/upload/src',
			),
			'@mailvideo/constants': toLibPath('mailvideo/constants/src'),
			'@mailvideo/frontend/components': toLibPath(
				'mailvideo/frontend/components/src',
			),
			'@mailvideo/frontend/repositories': toLibPath(
				'mailvideo/frontend/repositories/src',
			),
			'@mailvideo/frontend/services': toLibPath(
				'mailvideo/frontend/services/src',
			),
			$services: toLibPath('mailvideo/frontend/services/src'),
			// NB: /$services/loader has to come before $services/* because of the wildcard
			'$services/loader': toLibPath(
				'mailvideo/frontend/services/src/loader',
			),
			'$services/base-frontend-class': toLibPath(
				'shared/frontend/services/src/base-frontend-class',
			),
			'$services/*': toLibPath('mailvideo/frontend/services/src/lib'),

			$routes: toLibPath(
				'shared/frontend/services/src/lib/router/routes',
			),
			$router: toLibPath(
				'shared/frontend/services/src/lib/router/router-utils',
			),

			'@mailvideo/frontend/utils': toLibPath(
				'mailvideo/frontend/utils/src',
			),
			'@mailvideo/frontend/video/add': toLibPath(
				'mailvideo/frontend/video/add/src',
			),
			'@mailvideo/frontend/video/recorder': toLibPath(
				'mailvideo/frontend/video/recorder/src',
			),
			'@mailvideo/frontend/video/view': toLibPath(
				'mailvideo/frontend/video/view/src',
			),
			'@mailvideo/mocks': toLibPath('mailvideo/mocks/src'),
			'@mailvideo/player': toLibPath(
				'mailvideo/frontend/video/player/src',
			),
			'@mailvideo/schemas': toLibPath('mailvideo/schemas/src'),
			'@mailvideo/types': toLibPath('mailvideo/types/src'),
			'@mailvideo/utils': toLibPath('mailvideo/utils/src'),
			'@shared/constants': toLibPath('shared/constants/src'),
			'@shared/frontend/services': toLibPath(
				'shared/frontend/services/src',
			),
			'@shared/frontend/services/*': toLibPath(
				'shared/frontend/services/src/lib',
			),
			'@shared/frontend/test': toLibPath('shared/frontend/test/src'),
			'@shared/frontend/utils': toLibPath('shared/frontend/utils/src'),
			'@shared/frontend/utils/*': toLibPath(
				'shared/frontend/utils/src/lib',
			),
			'@shared/mocks': toLibPath('shared/mocks/src'),
			'@shared/svelte': toLibPath('shared/frontend/svelte/src'),
			'@shared/svelte-kit': toLibPath('shared/frontend/svelte-kit/src'),
			'@shared/table': toLibPath('shared/frontend/table/src'),
			'@shared/schemas': toLibPath('shared/schemas/src'),
			'@shared/types': toLibPath('shared/types/src'),
			'@shared/utils': toLibPath('shared/utils/src'),
			'@shared/logger': toLibPath(
				'shared/utils/src/lib/logger/svelte-kit',
			),
			'@shared/backend/configs/*': toLibPath(
				'shared/backend/configs/src',
			),
			'@shared/backend/utils/*': toLibPath('shared/backend/utils/src'),
		},

		// inline all stylesheets smaller than 1kb
		inlineStyleThreshold: 1024,
	},
	preprocess: [
		preprocess({
			postcss: false,
			scss: {
				outputStyle: 'compressed',
			},
			typescript: true,
		}),
	],
};

export default config;
vite.config.ts
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig, type PluginOption, type UserConfig } from 'vite';
import { isoImport } from 'vite-plugin-iso-import';
import windiCSS from 'vite-plugin-windicss';
import { sveltekit } from '@sveltejs/kit/vite';

// import { sveltekitPWA } from '@vite-pwa/sveltekit';

const directory = dirname(fileURLToPath(import.meta.url));
const rootDirectory = resolve(directory, '../../../..');

export default defineConfig(({ mode }) => {
	const plugins: PluginOption[] = [
		windiCSS({
			config: './windi.config.ts',
		}),
		isoImport(),
	];

	plugins.push(sveltekit());

	if (mode === 'analyze') {
		plugins.push(
			visualizer({
				brotliSize: true,
				filename: 'dist/stats.html',
				gzipSize: true,
				open: true,
			}) as unknown as PluginOption,
		);
	}

	const config: UserConfig = {
		build: {
			sourcemap: false,
		},
		envPrefix: ['PUBLIC_'],
		plugins,
		server: {
			fs: {
				allow: [rootDirectory],
				deny: [
					'C:\\ProgramData', // Block access to ProgramData
					'C:\\Windows', // Block access to Windows
					'C:\\$Recycle.Bin', // Block access to Recycle Bin
				],
			},
			port: 7000,
		},
	};
	return config;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions