You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a subscriber that triggers based on the product.updated event. When using the Local Event Bus, it triggers as expected. When I deploy to production, I am using the Redis Event Bus.
I have Redis Server using Docker (docker-compose file below) and setup using Medusa Config (file below).
When I launch the Medusa backend, it says the connection to the redis for the event bus was established successfully - But triggering an event does nothing. When I revert to local event bus without any other changes, my subscriber works as expected.
Package.json file
Node.js version
v20.12.1
Database and its version
PostgreSQL 17
Operating system name and version
MacOS
Browser name
Chrome
What happended?
I have a subscriber that triggers based on the product.updated event. When using the Local Event Bus, it triggers as expected. When I deploy to production, I am using the Redis Event Bus.
I have Redis Server using Docker (docker-compose file below) and setup using Medusa Config (file below).
When I launch the Medusa backend, it says the connection to the redis for the event bus was established successfully - But triggering an event does nothing. When I revert to local event bus without any other changes, my subscriber works as expected.
Medusa Config:
module.exports = defineConfig({ projectConfig: { databaseUrl: process.env.DATABASE_URL, http: { storeCors: process.env.STORE_CORS!, adminCors: process.env.ADMIN_CORS!, authCors: process.env.AUTH_CORS!, jwtSecret: process.env.JWT_SECRET || 'supersecret', cookieSecret: process.env.COOKIE_SECRET || 'supersecret', }, redisUrl: process.env.REDIS_URL, }, modules: [ { resolve: '@medusajs/medusa/event-bus-redis', options: { redisUrl: process.env.REDIS_URL, }, }, ], });
Docker Compose
version: '3.8' services: redis: image: redis:7 container_name: redis ports: - '6379:6379'
Subscriber Example:
`import { SubscriberArgs, type SubscriberConfig } from '@medusajs/framework';
export default async function productUpdated({
event,
container,
}: SubscriberArgs) {
const logger = container.resolve('logger');
logger.info('Product Updated!');
console.log(event);
}
export const config: SubscriberConfig = {
event: 'product.updated',
};`
On Launch:
info: Connection to Redis in module 'event-bus-redis' established
Expected behavior
Events should trigger when using Redis Event Bus
Actual behavior
Events not triggering when using Redis Event Bus, but they are triggering when using local event bus
Link to reproduction repo
npx create-medusa-app@latest and just add the same medusa config file for the redis event bus
The text was updated successfully, but these errors were encountered: