I am developing some Cloud Functions for Firebase, and one in particular does not work to an issue in one of the node modules on which my function depend.
I already found where is the issue and how to fix it, the problem is that, if I modify the source in node_modules/ folder, that update is not sent to the server. I removed from the package.json the dependency and did (before modify the file locally):
npm install --save pdf2img
But the function is not updated, the error is always the same. Is it possible to do what I would or not?
Thanks for anyone providing help!
Thanks to Mr.Phoenix hint, the solution is:
Fork the repository (or in my case, find a fork that already has the fix).
remove the previous version with:
npm uninstal --save pdf2img
npm install --save git+https://git@github.com/matteocontrini/node-pdf2img
The problem in this specific case cannot be solved because the library relies on "gm" and other libraries that are not available in firebase functions
protobufjs in your node_modules.protobufjs from your node_modules to functions folder.dependencies the following: "protobufjs": "file:./protobufjs" (assuming you placed the protobufjs folder in the root of functions folder).firebase deploy.If you have forked from the original repo to your own GitHub repo, you can clone your version into the root of your "functions" folder. Then:
If the package needs to be compiled into Javascript from Typescript, build the package using either yarn (there will be a yarn.json file) or npm (there will be a package.json file).
Do as the previous answer by Daniel Danielecki suggested and add to your dependencies the following: "[YOUR-PACKAGE-NAME]": "file:./[YOUR-PACKAGE-NAME]"
Try to deploy using "firebase deploy". You might receive an es-lint error similar to - "eslint error - Cannot find module '@[SOME-NAME]/eslint-config'". This is a bug in eslint and can be viewed here eslint bug. To fix this issue, simply add a ".eslintignore" file into the the root of your "functions" folder and add the line "[YOUR-PACKAGE-NAME]/*" to ignore the false linting errors for a successful deploy.