Version Packages (beta)#447
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
67e99ef to
e817383
Compare
e817383 to
6c9ee03
Compare
aeeb61c to
ca0005c
Compare
ca0005c to
bfaf8d8
Compare
bfaf8d8 to
30b73ab
Compare
There was a problem hiding this comment.
🔧 Build Fix:
Literal /proc filesystem paths in the Linux port detection code are being discovered by Vercel's NFT static analysis during SvelteKit build, causing it to fail when trying to access ephemeral file descriptors that no longer exist. The paths are encoded using Buffer.from(...).reverse().toString() to prevent static detection while maintaining runtime functionality.
View Details
📝 Patch Details
diff --git a/packages/utils/src/get-port.ts b/packages/utils/src/get-port.ts
index 1f59baf..207e6c8 100644
--- a/packages/utils/src/get-port.ts
+++ b/packages/utils/src/get-port.ts
@@ -18,14 +18,26 @@ function parsePort(value: string, radix = 10): number | undefined {
*/
async function getLinuxPort(pid: number): Promise<number | undefined> {
const listenState = '0A'; // TCP LISTEN state in /proc/net/tcp
- const tcpFiles = ['/proc/net/tcp', '/proc/net/tcp6'] as const;
+ // Use Buffer/reverse to encode paths so static analysis tools (like NFT) can't detect them
+ // This prevents NFT from trying to follow /proc paths as dependencies
+ const tcpFiles = [
+ Buffer.from('pct/ten/corp/').reverse().toString(),
+ Buffer.from('6pct/ten/corp/').reverse().toString(),
+ ] as const;
// Step 1: Get socket inodes from /proc/<pid>/fd/ in order
// We preserve order to maintain deterministic behavior (return first port)
// Use both array (for order) and Set (for O(1) lookup)
const socketInodes: string[] = [];
const socketInodesSet = new Set<string>();
- const fdPath = `/proc/${pid}/fd`;
+ // Encode path to prevent static analysis tools from discovering /proc paths
+ const fdPath =
+ '/' +
+ Buffer.from('corp').reverse().toString() +
+ '/' +
+ pid.toString() +
+ '/' +
+ Buffer.from('df').reverse().toString();
try {
const fds = await readdir(fdPath);
Analysis
NFT fails to trace /proc paths during Vercel adapter build
What fails: During SvelteKit build with @sveltejs/adapter-vercel, the Vercel deployment adapter's file tracing (using @vercel/nft) crashes when it encounters /proc filesystem paths that are created dynamically by the get-port.ts module.
How to reproduce:
cd packages/utils
git diff src/get-port.ts # Verify the original code has literal /proc paths
cd ../../workbench/sveltekit
VERCEL_DEPLOYMENT_ID=1 npm run buildResult (before fix):
error during build:
Error: File /proc/3487/fd/33 does not exist.
at Job.emitDependency (/vercel/path0/node_modules/.pnpm/@vercel+nft@0.30.3_rollup@4.53.2/node_modules/@vercel/nft/out/node-file-trace.js:336:23)Why it happens: Commit 34f3f86 added code to read /proc/<pid>/fd/ for port detection on Linux. During the SvelteKit build with the Vercel adapter, NFT performs static analysis and detects the literal /proc path strings in the code. When NFT tries to follow these paths as file system dependencies, it fails because:
- The file descriptors (e.g.,
/proc/3487/fd/33) are ephemeral OS-level references - They may no longer exist when NFT tries to stat them
- NFT has no way to exclude dynamic
/procentries from tracing
Root cause: Literal /proc string paths in the source code are visible to static analysis tools, causing them to attempt file system operations on ephemeral OS resources.
Solution: Encode the /proc paths using Buffer.from(...).reverse().toString() so they are not statically detectable by NFT while still being valid at runtime.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
mainis currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exitonmain.Releases
@workflow/ai@4.0.1-beta.23
Patch Changes
@workflow/astro@4.0.0-beta.2
Patch Changes
@workflow/builders@4.0.1-beta.19
Patch Changes
@workflow/cli@4.0.1-beta.23
Patch Changes
@workflow/core@4.0.1-beta.20
Patch Changes
waitedUntilpromise@workflow/errors@4.0.1-beta.7
Patch Changes
@workflow/next@4.0.1-beta.23
Patch Changes
@workflow/nitro@4.0.1-beta.23
Patch Changes
@workflow/nuxt@4.0.1-beta.12
Patch Changes
@workflow/rollup@4.0.0-beta.3
Patch Changes
@workflow/sveltekit@4.0.0-beta.17
Patch Changes
@workflow/swc-plugin@4.0.1-beta.9
Patch Changes
@workflow/utils@4.0.1-beta.5
Patch Changes
@workflow/web@4.0.1-beta.12
Patch Changes
@workflow/web-shared@4.0.1-beta.21
Patch Changes
workflow@4.0.1-beta.23
Patch Changes
@workflow/world@4.0.1-beta.8
Patch Changes
@workflow/world-local@4.0.1-beta.14
Patch Changes
@workflow/errorspackage to "dependencies" instead of "devDependencies"@workflow/world-postgres@4.1.0-beta.16
Patch Changes
@workflow/world-testing@4.0.1-beta.24
Patch Changes
@workflow/world-vercel@4.0.1-beta.14
Patch Changes