mbpictures / tessera

Open source and ready to use ticket shop with lots of customization abilities and feature rich admin dashboard. Several payment providers (stripe, paypal, sofort) are available out of the box and new ones can be added with ease.
MIT License
18 stars 2 forks source link

No assets after deployment to Vercel #95

Open sergeyClover opened 8 months ago

sergeyClover commented 8 months ago

Hello. I have been testing out the application and it seems like asset files such as HTML templates for emails and invoices are not present in .next folder after build.

I tried a few things in next.config.js as well as some testing with changing "copy-standalone" script but nothing seems to work.

Error:Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: ENOENT: no such file or directory, open '/var/task/.next/server/chunks/assets/invoice/template.html'","reason":{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, open '/var/task/.next/server/chunks/assets/invoice/template.html'","code":"ENOENT","errno":-2,"syscall":"open","path":"/var/task/.next/server/chunks/assets/invoice/template.html","stack":["Error: ENOENT: no such file or directory, open '/var/task/.next/server/chunks/assets/invoice/template.html'"," at Object.openSync (node:fs:596:3)"," at Object.readFileSync (node:fs:464:35)"," at getStaticAssetFile (/var/task/.next/server/chunks/4161.js:96:52)"," at /var/task/.next/server/chunks/7256.js:506:359"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: ENOENT: no such file or directory, open '/var/task/.next/server/chunks/assets/invoice/template.html'"," at process. (file:///var/runtime/index.mjs:1276:17)"," at process.emit (node:events:529:35)"," at emit (node:internal/process/promises:149:20)"," at processPromiseRejections (node:internal/process/promises:283:27)"," at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]} Unknown application error occurred Runtime.Unknown

Help would be appreciated. :)

mbpictures commented 8 months ago

Hi, and thanks for your request!

Your issue is most likely related to this issue of the next.js framework, which is the base of this project: https://github.com/vercel/next.js/discussions/32236

I have followed this issue a long time already and it seems that there's still no viable solution for this, but if you have an idea, please let me know! I "fixed" the issue by moving away from vercel and hosting the project on heroku. Unfortunately, they abounded their free tier.

sergeyClover commented 8 months ago

Just found out a solution:

  1. Move assets folder to project root
  2. Now assets are accessible with command: let basePath = process.cwd(); const filePath = path.join(basePath, assets/${file});

hope it helps someone in the future ;)

mbpictures commented 8 months ago

I'm glad to hear that you found a solution! Do you know if the code works in all three environments: development, production, and standalone production?

sergeyClover commented 8 months ago

Works in vercel production environment. Didnt test on dev or standalone just yet as it seems that puppeteer is not working as well on vercel.