How to use Node Modules in Cloud Functions

Hi All,

I’m trying to work with “files” in cloud-functions. Basically following this:
https://docs.moralis.io/files#server-side

I’m creating the cloud function in the portal using the web IDE.

When I try and invoke the cloud function I’m getting the error:
“Error: Cannot find module ‘request-promise’”

Basically it seems to have an issue with the following line in the demo code.:
const request = require(‘request-promise’);

How do you install node modules in cloud functions?

Thanks,

Hi itheum,

Thanks for reporting this issue! You can use Files in Clode Code in the same was as in the Browser. The docs here were incorrect and have been updated. The “server side” in this context is NodeJs, not Cloud Code.

1 Like