Function Compute connects to ApsaraBD for MongoDB service


Are you familiar with Function Compute in Alibaba Clould? I am trying to get my function to connect to my ApsaraDB for MongoDB service. However when I invoke the function I have an error message “Cannot find ‘mongodb’”. Usually on my local machine it can be easily fixed by ‘npm i mongodb’ but how could I fix it on Function Compute?

Thanks and regards,

Hi, Neo, here is the document about installing dependent libs on Function Compute.
I hope that helps.

1 Like

Hi @foolishneo,
You should be seeing /node_modules under your code repository.
mongodb is a custom module regarding Function Compute
if not, you can use npm install mongodb under your folder using fcli tool. If that is successfully installed you should see node_modules. This should fix the issue.
The whole process for this is explained here

Let me know if that worked or you need any more help! :slight_smile:

1 Like