When trying to read a file (fs.readFile()), it can’t be found by the production version of my function.
Reading this file and others works perfectly fine in development (netlify dev) so I don’t get why it doesn’t work in prod.
Here’s the full error message:
ERROR Uncaught Exception {"errorType":"Error","errorMessage":"ENOENT: no such file or directory, open '/var/task/app/mail/confirm_email/email_switch.hbs'","code":"ENOENT","errno":-2,"syscall":"open","path":"/var/task/app/mail/confirm_email/email_switch.hbs","stack":["Error: ENOENT: no such file or directory, open '/var/task/app/mail/confirm_email/email_switch.hbs'"]}
I’m trying to read the file from mail.js, a js file located within the app folder. The file I’m trying to read is in the ‘/mail’ folder, which itself is located in the app folder. Sounds a bit confusing so I’ll leave an image.
This doesn’t seem like it should be a problem. Is it possible for you to setup a minimal test repo with the same problem? It might need some investigation if you’re still seeing it.