Back

[Solved] Cache function deps installation with npm when deployed

  • 1
  • Self Hosted
  • Functions
LDs_Group
18 Oct, 2023, 10:07

Do you know how we can do ?

TL;DR
The user has a project where they use a function to initialize a database and test it locally before deploying it to the cloud. They want to avoid reinstalling dependencies if the package.json file doesn't change between deployments. The user also mentions that running the function with a slow network is causing delays. Another user suggests using a local registry or a proxy to cache the packages needed for installation. They share a link to a blog post explaining how to speed up npm install with a Nexus proxy. The original user is pleased with the suggestion and says they will try it. The thread ends with a request to let them know if there's anything else they
Drake
18 Oct, 2023, 17:17

why?

LDs_Group
19 Oct, 2023, 06:21

I dev locally before upload. So many times, I'm offline. But to deploy function, we need network

LDs_Group
19 Oct, 2023, 06:23

If I success deploy one time and that package.json doesn't not change next time, I preferred avoid to reinstall deps

Drake
19 Oct, 2023, 18:43

and this is for self-hosted?

LDs_Group
19 Oct, 2023, 18:44

For now but After project finish, I will deploy to cloud

Drake
19 Oct, 2023, 18:46

how do you deploy?

LDs_Group
19 Oct, 2023, 18:49

It's fresh project. I use function to initialize db, collections, ... and test with localhost. After satisfied, I will just change localhost to cloud address and run the functions

LDs_Group
19 Oct, 2023, 18:51

It's amazing but run every time function with network slow the process

VincentGe
19 Oct, 2023, 18:53

Consider using something like a local registry

VincentGe
19 Oct, 2023, 18:53

as a proxy

VincentGe
19 Oct, 2023, 18:53

and configure it to cache the packages you need

LDs_Group
19 Oct, 2023, 18:58

Nice

VincentGe
19 Oct, 2023, 18:59

Try it, I think it should work

VincentGe
19 Oct, 2023, 18:59

Lmk if it does

Drake
8 Nov, 2023, 01:02

Do you need anything else or can this be closed?

LDs_Group
8 Nov, 2023, 10:45

[Solved] Cache function deps installation with npm when deployed

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more