-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
pkg:adapter-vercelPertaining to the Vercel adapterPertaining to the Vercel adapter
Milestone
Description
Describe the bug
Sveletekit PdfMake font import works fine locally but crushes when deployed to vercel
Reproduction
this is the code:
const fonts: TFontDictionary = {
Futura: {
// FuturaPTBook.otf
// FuturaPTCondBold.otf
normal: `./static/fonts/FuturaPTBook.otf`,
bold: `./static/fonts/FuturaPTBold.otf`
}
};
const printer = new PdfPrinter(fonts);
i also created a fonts folder a the same place where the file exists and i imported the fonts using
import normal from "./fonts/FuturaPTBook.otf"; and i did this:

const fonts: TFontDictionary = {
Futura: {
// FuturaPTBook.otf
// FuturaPTCondBold.otf
normal: path.join(".",normal),
bold: path.join(".",bold)
}
};
but it worked locally and it crashed on vercel
Logs
Error: ENOENT: no such file or directory, open '_app/immutable/assets/FuturaPTCondBold.35d3f580.otf'
at Object.openSync (node:fs:601:3)
at Object.readFileSync (node:fs:469:35)
at PDFFontFactory.open (/var/task/vercel/path0/node_modules/@foliojs-fork/pdfkit/js/pdfkit.js:3384:16)
at PDFDocument.font (/var/task/vercel/path0/node_modules/@foliojs-fork/pdfkit/js/pdfkit.js:3454:33)
at FontProvider.provideFont (/var/task/vercel/path0/node_modules/pdfmake/src/fontProvider.js:62:58)
at /var/task/vercel/path0/node_modules/pdfmake/src/textTools.js:326:27
at Array.forEach (<anonymous>)
at measure (/var/task/vercel/path0/node_modules/pdfmake/src/textTools.js:298:13)
at TextTools.buildInlines (/var/task/vercel/path0/node_modules/pdfmake/src/textTools.js:32:17)
at DocMeasure.measureLeaf (/var/task/vercel/path0/node_modules/pdfmake/src/docMeasure.js:235:28) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '_app/immutable/assets/FuturaPTCondBold.35d3f580.otf'
}System Info
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (4) x64 Intel(R) Core(TM) i5-3360M CPU @ 2.80GHz
Memory: 2.68 GB / 7.68 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 3.6.0 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
pnpm: 8.6.7 - ~/.nvm/versions/node/v18.16.0/bin/pnpm
Browsers:
Chrome: 115.0.5790.170
npmPackages:
@sveltejs/adapter-auto: ^2.0.0 => 2.1.0
@sveltejs/kit: ^1.20.4 => 1.22.3
svelte: ^4.0.5 => 4.0.5
vite: ^4.4.2 => 4.4.4Severity
serious, but I can work around it
Additional Information
No response
Metadata
Metadata
Assignees
Labels
pkg:adapter-vercelPertaining to the Vercel adapterPertaining to the Vercel adapter