skip to Main Content

I have configured some local folders that get built into /lib as shared modules. These work locally perfect. Only, when deploying functions the code is not finding this modules:

src/routes/stats/types.ts(40,41): error TS2503: Cannot find namespace 'db'.
src/routes/stats/validations.ts(4,34): error TS2307: Cannot find module '@shared_resources/functions/modulesWithoutGP' or its corresponding type declarations.

When I look locally, the files are in the proper location:
package.json snippet

folder structure snippet

It feels like it fails to generate the lib/configs.
Does it upload all folders in /lib?

2

Answers


  1. Chosen as BEST ANSWER

    I solved it. The issue was deploying just ONE function (--only functions:functionName)

    It seems like not all context is taken then.

    Deploying all functions did the trick.


  2. The reason why it works locally and not when deployed is maybe because of caching. As observed in this case, he was having trouble deploying his functions, and he wonders because it works locally. To summarize he found a problematic module that he renamed recently that is causing the errors on the deployment, but works locally.

    It could be beneficial to check if there’s any recent changes on the naming convention of your modules. You can also try to delete your local repository, delete all cache, clone it again, then try running it locally. This will prevent caching to happen, and you can see if it truly works locally. 

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search