#Subscribers not working after deployment.

39 messages · Page 1 of 1 (latest)

heady dust
#

I have a subscriber which listens for an order to be placed, and then sends a notification email when the order is placed to the customer via sendgrid. This works entirely as expected on my local development server. When deployed and live, nothing happens, and in my server log I get the error "{"level":"warn","message":"An error occurred while processing order.placed: ReferenceError: promiseAll is not defined","timestamp":"2023-11-20 21:16:01"}

How can I diagnose what is going on since it does not happen in the slightest on my local dev server?

austere wolf
#

Your utils package might not be updated, check your version on update your yarn lock

alpine wren
#

But your deployment method should still rely on lock file and should have the same deps as local.

heady dust
#

@austere wolf in my package.json file @medusajs/utils was not even a dependency. I added that and I will see if that fixes the issue in prod. But I am getting entirely different behaviors in a couple areas in prod vs dev.

If it does not however, @alpine wren what can I do until that version is updated? I wanted to launch my store for black friday. Am I forced to wait?

alpine wren
#

It has been published today

heady dust
#

@alpine wren Okay, I have updated and am unable to figure out the new subscriber API at all... the backend will not even register that any subscribers are listening to order.placed. It doesn't even show up as an event in the log... What am I missing?

alpine wren
heady dust
#

When I upgraded, my old subscriber stopped working in production. For some reason still works in development. I'm clueless.

austere wolf
#

what event bus module are you using? also, if you say it works locally but not in production it often means that you still have someting different, can be your lock file which force a version in prod but you have a different version locally, it can be your configuration that differ or other things maybe

heady dust
#

I'm using event-bus-redis and trying to access the orderService. I'll try to check on the lock file to see if something is different in there. I was getting a handful of different behaviors between prod and development.

heady dust
#

What I really don't understand is why there is no order.placed event emitted...

austere wolf
#

export default function(something) {
  return
}

export const config: SubscriberConfig = {
  event: "order.placed",
  context: {
    subscriberId: "test"
  }
}```
#

I am unable to reproduce, I get the events fired including the order.placed and my subscriber get called as well

#

I ve also tried with your code

#

Tested and latest and next

heady dust
#

I am completely clueless... I'm going to try re-initializing my medusa backend... Because my taxProvider broke for some unknown reason as well... Is that what you would recommend to do?

pine mantle
#

@heady dust what platform are you using for hosting AWS, Azure, Vercel.... might be a blocked port. Just my 2 cents.

heady dust
#

@pine mantle Admin is on vercel, server on render. But I get the same exact behavior in local production.

pine mantle
#

@heady dust in your initial post you said everything was working fine on your local install. Is this still the case? Have you made any code changes to your Vercel/Render rig?

heady dust
#

@pine mantle Sorry for the confusion, I actually deleted my dist folder on my local install which must have had old code that was still being referenced. After deleting/rebuilding my local and my prod environment behave the same now.

Local and prod are running the exact same code from the same github repo, the only difference being the .env.

pine mantle
#

@heady dust what stack are you using for your local install (VM, workstation, container.... more than one)? Is the github repo yours or MedusaJS?

heady dust
#

@pine mantle Debian linux machine, using npm to install to a local folder and running it that way. I am using the official medusa repo, unmodified. And then my front-end code,

Full stack is next.js frontend with sanity.io CMS, and medusa for the shop/admin.

pine mantle
#

@heady dust - All on the same "machine"? Have you tried a network capture, via tcpdump, to see anything telling?

#

I assume the Debian machine is a VM?

#

tcpdump will more than likely need to be both on the 'lo' device and the network interface communicating with sendgrid.

#

sudo tcpdump -i any -w dev_capture.pcap

#

The above command will capture on all, local and network, interfaces. Then open with Wireshark to hopefully see if the response or lack of response. Depending on the rig the .pcap file might contain private information if it isn't being sent over https.

heady dust
#

@pine mantle Yeah so i just initialized a new medusa project from the ground-up, and I am now getting the proper events emitted. Something was wrong with my dependencies or how my packages were updated or something. Going to just replace my old medusa instance with this one and re-install the plugins and whatnot.

Thanks for trying to assist.

heady dust
#

@pine mantle @austere wolf I figured out that it is something to do with event-bus-redis. When I disable it and use fake redis, every event is emitted, but with my redis cloud initialized and enabled in config, the emitted events disappear.

#

I only get some events emitted with fake redis/redis cloud disabled.

austere wolf
#

You shouldn’t use fake redis, just for test only and not even proper deep tests

heady dust
#

Well, it got me to the bottom of the issue. Redis cloud for some reason does not emit a handful of events. Using a redis instance provided by render instead got me the result I want and it's working perfectly now.