Nextjs build failure with module alias, how to debug?

I am deploying a NextJS + Typescript web app for the first time on Render. Locally, I can run next build successfully. This also works in a simple Dockerfile. However, on Render the same steps fail with: Type error: Cannot find module '@shared/services/db/dbResults' or its corresponding type declarations. – it seems like the module alias here is failing.

How can I debug this issue? I am using the exact same version of Node in Docker and locally, and Docker does the exact same setup steps. Is there anything else that could be different in however Render is doing the build?

Okay, it looks like the issue is actually about case-sensitive names. On MacOS (including Docker?) it is case-insensitive and loads the file correctly, but I assume Render builds on some flavor of linux (I was able to reproduce the issue on AWS linux). Git unfortunately does not respect case-sensitivity, so it was not obvious that this was different locally from on Render.

Hi,

Just beat me to it. The dbResults of the error made me think it may be a case-sensitivity issue, which Render’s environments are.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.