sveltejs / sveltejs/kit

[@sveltejs/adapter-vercel] Function name length check

Open
#12,803 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-vercel
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

https://vercel.com/docs/functions/limitations#functions-name

The following limits apply to the function's name when using Node.js runtime:

Maximum length of 128 characters. This includes the extension of the file (e.g. apps/admin/api/my-function.js is 29 characters)
No spaces are allowed. Replace them with a - or _ (e.g. api/my function.js isn't allowed)

There should be a check for this at this line:

handler: path.relative(base + ancestor, entry),
Reproduction

Create a deeply nested folder structure in your git repo and setup the build in that directory.

Logs

No response

System Info
System:
    OS: macOS 15.0.1
    CPU: (16) arm64 Apple M3 Max
    Memory: 711.11 MB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.8.0 - ~/Library/pnpm/node
    npm: 10.8.2 - ~/Library/pnpm/npm
    pnpm: 9.12.1 - ~/Library/pnpm/pnpm
    bun: 1.1.30 - ~/.bun/bin/bun
    Watchman: 2024.08.19.00 - /opt/homebrew/bin/watchman
  Browsers:
    Safari: 18.0.1
  npmPackages:
    @sveltejs/adapter-auto: ^3.2.5 => 3.2.5
    @sveltejs/adapter-node: ^5.2.6 => 5.2.6
    @sveltejs/adapter-vercel: ^5.4.5 => 5.4.5
    @sveltejs/kit: ^2.7.0 => 2.7.0
    @sveltejs/vite-plugin-svelte: ^3.1.2 => 3.1.2
    svelte: ^4.2.19 => 4.2.19
    vite: ^5.4.8 => 5.4.8


### Severity

blocking all usage of SvelteKit

### Additional Information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the adapter-vercel code containing handler: path.relative(base + ancestor, entry) and trace how function names are generated. Reproduce the issue with a deeply nested folder structure, then verify that generated names are checked against Vercel's 128-character and no-space limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.