#Not all Notification Events sent in each environment

26 messages · Page 1 of 1 (latest)

astral mountain
#

It seems to me that not all notification events are triggered in all environments. I have been scouring the codebase, but cannot figure out where this is actually defined. Can someone point me to the code or documentation to figure this out? Need to know for accurate testing of notifications.

For instance, it appears that 'order placed' notifications are not sent in NODE_ENV = development. This is expected (and actually good) because I wouldn't want to trigger these.

fast stag
#

This shouldn't be true. I'm always testing notifications on order.placed in development. medusa 1.7.14

astral mountain
#

Hrrrm.. Ok, seems I have more investigations to do. I get about half of the notifications sending (and showing up in console.log) and the other half not. I suppose I should say this is with the NextJS starter.

fast stag
#

Storefront has got not much to do with. events are backend thing.

astral mountain
# fast stag Storefront has got not much to do with. events are backend thing.

Yeah, I wasn't sure yet if the frontend sent a request to the backend that suppressed the notification, but if that's not the case then it will be completely backend. It's very strange, I've barely edited the backend (on medusa 1.10.0), other than installing packages and modifying environment variables. I have individual email templates for every event. But it seems to be very inconsistently generating events.

For instance, yesterday I was getting emails for gift card creation and order cancellation and user password resets. But now today, when I cancel an order or request a password reset I get nothing in the logs, but when I generate a gift card I still correctly see:

info: Processing gift_card.created which has 0 subscribers

And I get the email sent through sendGrid.

The inconsistent behaviour had led me to think it may be a NODE_ENV thing.

astral mountain
#

Further testing, on a single server (run with yarn start) I made new gift cards 10 times always to the same email address. It triggered the gift_card.created event only 8 times in the logs. Of note I'm hooked up to a postgres and redis service in Railway. Have had no other issues like this except related to events not triggering.

The inconsistency bothers me more than anything. Why would an event triggered in the same way on the same server only process 80% of the time? Any ideas or suggestions on tests welcome.

balmy briar
#

I have the same notification problem in production with 1.10.0

fast stag
#

I would suggest to make an issue with that one.

balmy briar
#

I restarted the ECS Service and ElasticCache for Redis and all notifications were sent, so maybe an event bus problem?

astral mountain
astral mountain
astral mountain
# fast stag I would suggest to make an issue with that one.

Note that I spent a few hours testing, trying to find something I may have done and still cannot figure this out. My project is very close to the basic install with a few plugins added and configured. But inconsistent throwing of events is a serious issue of course.

See the issue here https://github.com/medusajs/medusa/issues/4089.

GitHub

Building blocks for digital commerce. Contribute to medusajs/medusa development by creating an account on GitHub.

fast stag
#

Looks like a solid issue, great insight. Such issues is why I'm still on 1.7.14. Still hesitant to upgrade to 1.8 and later version due to some open issues in terms of performance and stability. And I value those over new features. Unfortunately I don't have much time now to test out the newest versions and provide some feedback or reproduction for those bugs. Hopefully most of those issues will be resolved soon. 1.8 release was huge and even tho team has done fantastic work, bugs were unavoidable. Unless I'm wrong and most of these bugs are more of individual cases and don't occur for everyone.

raven pilot
#

I've yet to see any dropped events using 1.10.0, but I'm also still in a dev environment with a ridiculous amount of memory. I'm wondering whether this issue might possibly be related to the large number of calls to redis reported by other users. It may the type of issue that excessive resources can temporarily mask, making it difficult to see in testing.

astral mountain
# raven pilot I've yet to see any dropped events using 1.10.0, but I'm also still in a dev env...

If I'm understanding you correctly then I'm not sure I get it for my situation. This is in a development environment, where I'm the only user. And some of the dropped events are when nothing is being done on the site, and then I click one thing that triggers the action that should trigger the event. If it's dropping events due to volume when there's only a SINGLE action, then there's no way this holds up in production with real users.

grave relic
#

The message Processing X subscribers does not count the listener on *. But the * listener always exists for the notification. Which is why you still receive an email on the event. But, you have 0 custom subscriber on this event that listen to this particular event

#

Also, which event module are you using?

eternal fossil
#

Hi! I don't know if my issue is the same as yours. Since I upgraded from Medusa 1.8 to Medusa 1.9, all the notifications triggered from admin such as order is shipped is not triggered. Only order.placed which is triggered from store works:

grave relic
#

what event do you mean by order is shipped?

fast stag
#

I'm guessing order.shipment_created (Mark as shipped in admin). I use the same for sending email with nodemailer to the customer

eternal fossil
grave relic
#

And have you marked it as shipped to trigger the event?

merry grail
astral mountain
#

Hey @merry grail @grave relic I see questions about my versions. In the GitHub issue I shared a link to my entire codebase where you can see all the versions. If there's any documentation missing from the issue please ask.

astral mountain
astral mountain