I am using mmwr-week package. For some reason it takes about 30 seconds on average to run the following code in Realm while it takes about 0.15 seconds on my MacBook Pro:
exports = function(){
const mmwr = require("mmwr-week");
let mdate = new mmwr.MMWRDate();
const d = new Date();
for (let i = 0; i < 1000; i++) {
mdate.fromJSDate(d);
}
};
Any ideas why there is a ~200x difference in performance?
There are some improvements we have planned to make dependency resolution a bit faster over the next few months. In the meantime, I would suggest looking into an alternative package if the latency is blocking.
@Sumedha_Mehta1 whatever happened here? I’m having the same issue with Stripe. It’s taking 1 minute and 15 seconds to complete a simple call to list customers by email address. The function executes quickly (including loading the dependencies with require) up until I call stripe.customers.list. This same call take < 100 ms on my local machine or within a Firebase function. Something is definitely wrong.
No, it’s not solved. This is what I got back from support:
I was able to reproduce this on my side using your simplified code sample and it also took 1m15s for me.
After researching further I found that this is a known issue on our side when using the Stripe API in functions where requests are taking up to 50-60 seconds to complete. This is a known issue on our side with how we’re handling the Stripe request and our Engineering team are currently in the process of analysing the issue.
Unfortunately I don’t have an ETA to provide you with for when this will be fixed, however I will track the work on our side and update you in this case when there is progress.
This is extremely disappointing and leads me to believe that Realm triggers / Mongodb Functions are not production-ready as a lambda drop in replacement… I think Triggers/Realm Functions would only be suitable for Mongo Actions that require no additional third party dependencies. If stripe connections are taking more than 4 seconds to complete you have a problem. I personally am using Lambda’s and Cloudflare functions, was thinking about realm triggers but after this, i will hold off.
Based on the reply from support, they seem to claim it’s Stripe only. I ended up not using the stripe node SDK and I wrote the requests manually using the http service. Not a huge deal and somewhat annoying, but not the end of the world. Everything works great (including the triggers).
Hi all - we’re still investigating why the stripe dependency is slower, unfortunately it’s not as straightforward to fix as hoped. I do want to call out that our dependency functionality is still in beta and if you’re having issues with them, there are immediate work arounds (such as calling the API directly). However, we’re carefully monitoring any dependency bugs that show up and filing tickets to address them. If any other part of Realm is not working as expected, please let us know!
This is not Stripe only, I have the same issue with Algolia.
In my case it just times out and don’t update Algolia.
My function is a simple database trigger, that updates the object to Algolia with “saveObject”. The function runs fine, nothing is slow regarding the required dependency, then, at the index.saveObject the functions just hangs out forever, and Algolia is not even updated.
My guess it’s something regarding network. But looks very much like this issue with Stripe.
It’s a very important fix, basically kills the Realm Functions, and I am about to integrate Stripe too.
Hello MongoDB, did you get improvements on this executions times? I am about to integrate payments through Stripe into my app, and I can’t loose sales. If I loose sync to Algolia, I can recover later, but that is not feasible for sales.
I use Realm Password Auth for my app, so relying on Realm Functions is wanted, where I can check the auth state. So having Stripe into the Realm Function is very very needed.
Thanks, I want to rely as much as possible into the MongoDb platform.
Realm Functions / Mongo Triggers have had little or no release updates (or atleast not disclosed) it seems this is not a focus they want to target as a lot of q’s remain unanswered. I myself have moved on to Lamda and Cfloudflare functions to solve my problems… Yes its a pain as Realm Auth was good, but that too has seen no improvement and no mentioned of passwordless auth.
If you are a enterprise customer you should get a reply or try online chat support.
I have the same issue using the AWS-SDK in MongoDB functions. When I try to upload an image to a S3 bucket it takes around 30 to 60 seconds! When I try this on my local machine or a different location it takes around 150ms.