Example of external dependency module in Functions

Hi,
anyone willing to share ‘Hello World’ of external dependency module for Real functions?

Hi @Tomas_Kaminskas,

There are a few examples in Import External Dependencies. You need to Upload External Dependencies before they can be used, and compatible packages must meet the runtime constraints for Realm functions.

If you are having issues uploading a specific external dependency, please provide more information including the npm package, version, and the error message or behaviour you would like help with.

Regards,
Stennie

Hi, thanks for the reply, I read the documentation, but my question was about external module itself, not how to import or use it (which is documented there). I would love to see example helloworld node module source code and how it’s structured.

Hi @Tomas_Kaminskas,

The structure of external modules is the standard Node.js module layout as used by packages on npm. See Creating Node.js modules for a tutorial.

The general idea is that you can upload external dependencies for use subject to the runtime constraints of Realm Functions.

Per the instructions on Uploading External Dependencies you would npm install your custom module and any other required dependencies, then archive the node_modules/ directory and upload to MongoDB Realm. npm install supports installing packages from a variety of sources including git, local folders, or local tarballs so your custom module does not have to be uploaded to the central npm repository.

Regards,
Stennie