Open Wet-Bones opened 1 year ago
@Wet-Bones
Try using the environment variable in lambda - ${process.env.LAMBDA_TASK_ROOT}
. It gives you the path to your lambda function.
Example:
const logo = ${process.env.LAMBDA_TASK_ROOT}/pdfhandler/assets/logo.png;
I'm getting the same error trying to generate a new PDF in a NextJS 13 API route. Did you ever find a resolution to this issue?
I'm getting the same error trying to generate a new PDF in a NextJS 13 API route. Did you ever find a resolution to this issue?
So I ended up downloading fonts as ttf files and storing them in the project directory. In order for them to be deployed properly, you have to configure that API route to copy the files to your assets bucket. The nodejs format must also be in cjs I believe.
That's good to know, I ended up putting the API route under the pages directory and it seems to work.
I'm getting the same error trying to generate a new PDF in a NextJS 13 API route. Did you ever find a resolution to this issue?
Same here... any ideas how to resolve this? Switching to pages is not an option for me.
This is probably the same problem as in my case: https://github.com/foliojs/pdfkit/issues/1491 and it's due to PDFKit not being compatible with ESM
When I try to generate a pdf, my console returns:
ERROR Error: ENOENT: no such file or directory, open 'C:\Users\Me\Project\.sst\artifacts\dev-app-ApiStack-api-Lambda_POST_-doc\services\functions/data/Helvetica.afm'
The only thing I've specified in the code as far as font is to use Helvetica and Helvetica-Bold at certain locations. Does the issue have to do with my __dirname?