Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18nContext undefined for RabbitMq messages #581

Open
5 tasks done
linconsdev opened this issue Oct 5, 2023 · 1 comment
Open
5 tasks done

I18nContext undefined for RabbitMq messages #581

linconsdev opened this issue Oct 5, 2023 · 1 comment

Comments

@linconsdev
Copy link

Describe the bug

I'm using microservices with RabbitMq and I'm trying to pass language over message in message header.
I've made customer resolver and it does actually resolve the right language from header and returns it but in service i18nContext is always undefined.

I've also put { inheritAppConfig: true } in main.ts for RabbitMq

I've also noticed that in controllers i18nContext is ok but in services is undefined...

Reproduction

2 nestjs hybrid applications with rabbitmq

System Info

Win11

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@lucas-gregoire
Copy link
Contributor

lucas-gregoire commented Nov 3, 2023

Hello,

On RabbitMQ consumers, HTTP middlewares aren't used, so we only rely on I18nLanguageInterceptor to resolve the lang and initialize the I18nContext, but currently it doesn't allow to define additional interceptors on endpoints/rmq consumers.

So maybe you have additional interceptors on your RabbitMQ consumers ?
In this case, I think your issue could be solved by the PR i've just opened: #594.

Or maybe you have a different setup, can you tell a bit more about it ?
What library do you use for your RabbitMQ subscriptions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants