In my NodeJS application I have few common code that could be used by many other Cloud Functions in GCP. But I don't know how can I share these code among multiple apps to reduce code redundancy.
I thought of keeping these files in GCS and use that file location in NodeJS but I am sure it won't support this way as I may need to download this file before using it.
So, is there any better way to accomplish my idea?
What is the best way to use local module in NodeJS Cloud Functions?
377 views Asked by shary.sharath At
1
There are 1 answers
Related Questions in NODE.JS
- Using Puppeteer to scrape a public API only when the data changes
- How to request administrator rights?
- How do I link two models in mongoose?
- Variable inside a Variable, not updating
- Unable to Post Form Data to MongoDB because of picturepath
- Connection terminated unexpectedly while performing multi row insert using pg-promise
- Processing multiple forms in nodejs and postgresql
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How to change the Font Weight of a SelectValue component in React when a SelectItem is selected?
- My unban and ban commands arent showing when i put the slash
- how to make read only file/directory in Mac writable
- How can I outsource worker processes within a for loop?
- Get remote MKV file metadata using nodejs
- Adding google-profanity-words to web page
- Products aren't displayed after fetching data from mysql db (node.js & express)
Related Questions in GOOGLE-CLOUD-FUNCTIONS
- Protect OpenAI key using Firebase function
- pnpm firebase app "Could not find a declaration file for module 'mime'"
- Setting document field value using Firestore Functions
- Firebase authentication sign up token
- Nonsense error using a Python Google Cloud Function
- run dart script from firestore cloud functions
- Why New Google Cloud Pricing Calculator has huge costs different from Legacy One?
- Google Cloud Function with express returns TypeError: stream.listeners is not a function
- Use firebase-functions for firebase v2 cloud functions
- How can I improve concurrent message processing with Google Task Queue?
- Error with firebase deploy --prefix $RESOURCE_DIR run lint giving functions/functions
- Authenticated HTTP Request to External API
- Firebase Functions: How to use second database
- Trigger a Cloud Build to only re-deploy GCP Cloud functions that were updated within the same repo
- FireStore or FireStoreClient class for Java Firestore client library?
Related Questions in LOCAL-NODE-MODULES
- npm-cron issue with task.stop() from inside another function
- In angular, the size of my main.js file is 20mb and vendor.js file is 7mb, what could be the issue and how can I optimize my build?
- Using npm on a machine without internet access, but with lots of modules in mutiple node_modules directorties
- What is the best way to use local module in NodeJS Cloud Functions?
- When I build docker image, i want to prevent installing node_modules in my local directory
- Do we need to install all plugins from scratch in Gatsby?
- using a locally edited npm package
- How to put webPack config file in to node modules?
- How to update local node_module dependency and reload in another project?
- Visual Studio Code ionic "node_modules" unavailable
- How to allow a custom local node_module to navigate project file system?
- Why Angular 2+ need to be pre-installed before creating project since it has node_modules installed itself?
- Can't succeed in unexcluding node_modules in WebStorm Node React
- electron install error : Generated checksum for "electron-v2.0.2-win32-x64.zip" did not match expected checksum
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
You have several way to solve that.
At deployment time (with your CI/CD, on Cloud Build for instance) you can copy the common dependencies in the Cloud Functions code base and then deploy it. It's (it was) a common and usual way to share common code with Cloud Functions.
But, a more recent way is to use Artifact Registry to store your NodeJS modules. Then, in your cloud functions dependencies, reference that module in Artifact Registry to let Cloud Functions downloading it.
It's a better solution because you use standard code packaging and dependencies, it's private to your project (except if you open your registry publicly) and you haven't hack to do.
--
You can also switch to Cloud Run, where you control your container creation and download the file that you want. It's not Cloud Functions, but it's very similar (and it's my personal preference)