toonvanstrijp / nestjs-i18n

The i18n module for nestjs.
https://nestjs-i18n.com
Other
624 stars 102 forks source link

I18nContext.current() return undefined #590

Open vqhdev opened 8 months ago

vqhdev commented 8 months ago

Describe the bug

I encountered the I18nContext.current() returning undefined:

....\i18n-error\src\http-exception.filter.ts:21
message: i18n.t(test.${status}),
^
TypeError: Cannot read properties of undefined (reading 't')

You can access my entire codebase here (https://github.com/vqhdev/nestjs-i18n-error)

Reproduction

I'm facing an issue with the HttpException filter when deliberately sending invalid data to the server. The error occurs when sending the following curl request:

curl -X POST http://127.0.0.1:3000/test -H "Content-Type: application/json" -d "{\"h\":\"}"

Or with any data that doesn't comply with the application/json format.

System Info

Binaries:
    Node: 18.18.2
    npm: 9.8.1
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (117.0.2045.60)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Validations