Problem with loading translations files while working with i18n on my API.
uginy opened this issue · comments
Hello!
Mb someone faced with integration of i18next on backend side while developing api with sst. Translation files couldn't copy to artifacts, as results can't work with i18n on backend.
[Error: ENOENT: no such file or directory, open '/Users/user/projects/project/my-sst-app/.sst/artifacts/c825b0670a4bb91e87d5f900b7f0b617d0e1374668/packages/functions/src/i18n/locales/en/pdf.json'] {
| +227ms errno: -2,
| +227ms code: 'ENOENT',
| +227ms syscall: 'open',
| +227ms path: '/Users/user/projects/project/my-sst-app/.sst/artifacts/c825b0670a4bb91e87d5f900b7f0b617d0e1374668/packages/functions/src/i18n/locales/en/pdf.json'
| +227ms },
folder structure:
/ packages / functions / src / i18n / locales/ en / common.json
i18nInit() did in several places, in / stack / MyStack when api loads and tried many places. No way.
I use pnpm for running my project
Will be glad for any kind of advice.
My server env: MAC OS Sonoma, node v18.15.0, pnpm as package manager.
Project written on typescript.
I'm not sure what your exact setup is, but it sounds like you need to copy over these files to your function bundle? https://docs.sst.dev/constructs/Function#copyfiles
If you need more help with this, create a new thread in #help on Discord?