How to replace AWS Service [Depreciated] with HTTP Endpoints?

I’m trying to implement a system similar to the O-FISH app in which small-ish binary images are uploaded to MongoDB from a Realm Sync mobile app, then a trigger sends the image file to an AWS S3 bucket and get the image URL in return to store in MongoDB.

I’ve followed the O-FISH tutorial to the letter but it appears MongoDB’s AWS Service is now depreciated in favour of HTTP endpoints that use external dependencies. I’m not sure where to begin with these. How would one connect to an S3 bucket using enpoints?

Any help would be hugely appreciated!

Hi @Laekipia !

The idea now is to use NPM external dependencies. See the warning at the top here.

I think the idea is to use this instead now or this maybe?

Cheers,
Maxime.

Hi @Laekipia , @MaBeuLux88 is correct that the idea is to now use NPM dependencies. We are currently working on adding support for the v3 AWS SDK (some functionality may not work in v3) but we support v2 right now. HTTPS Endpoints are primarily replacing the functionality of incoming webhooks, such as those on the http service. If you are following the tutorial linked above, the “uploadImageToS3” function would be only the part that would be updated.

Instead of calling the aws service via context.services.get('AWS') , the suggested approach is to upload the aws sdk dependency and use s3 in your function that way so you won’t need to use the new HTTPS Endpoints functionality for that use case. I don’t have a working example on hand but this code example might help

2 Likes

Hi @MaBeuLux88 and @Kush_Patel, thanks a lot for your replies! It’s been really useful!

I’ve tried to install aws-sdk from here as an NPM dependency to use in my uploadImageToS3 Realm Function but I got the following error when adding the dependency:

Note: I tried to install it by specifying the version (2.1046.0) and then I tried without specifying any version and got an error in both cases.

Am I doing something wrong?

If anyone else is encountering the same issue when installing the aws-sdk dependency in Realm, I had to install specifically version 2.797.0 for it to work.

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.