Vercel only packs the files it can trace from your imports into each function. A path you build at runtime with path.join and read with fs is invisible to that tracing, so the file isn't in the function bundle.
Simplest fix: import it, then it's part of the bundle and you don't need fs at all:
import postcodes from "@/data/postcodes.json";If you really need to read files at runtime (many files, or a format you can't import), tell Next to include them:
// next.config.js
module.exports = {
outputFileTracingIncludes: {
"/api/postcodes": ["./data/**/*"],
},
};Don't rely on /public for this. Those files go to the CDN, not reliably into your functions.