Questions tagged [nestjs-config]

196 questions
2
votes
0 answers

How to catch NestJS redis retry strategy error

I've created a NestJS redis cache module with a retry strategy. @Module({ imports: [ CacheModule.registerAsync({ isGlobal: true, imports: [ConfigModule], useFactory: async (configService: ConfigService) =>…
bmd
  • 1,231
  • 3
  • 15
  • 23
2
votes
1 answer

How to use character '#' in @nest/config ".env.dev"?

Is there any way to use '#' in .env.dev file? My MySQL password has '#' DB_HOST=localhost DB_PORT=3306 DB_USERNAME=root DB_PASSWORD=mypass#word DB_NAME=testdb NODE_ENV=dev this code recognized like 'mypass'
홍윤기
  • 23
  • 4
2
votes
8 answers

In Nest js, I added Redis as a cache manager. And can't find any added data in Redis after calling the set function. So, am I missing something?

Node version: v14.15.4 Nest-js version: 9.0.0 app.module.ts Here is the code. In the app module, I am registering Redis as a cache manager. @Module({ imports: [ CacheModule.register({ isGlobal: true, store: redisStore, url:…
Nairi Abgaryan
  • 616
  • 5
  • 16
2
votes
1 answer

NestJs ParseEnumPipe can't be resolve

I am using the NestJs framework (love it by the way) and I want to check the incoming data so it conforms with an Enum in Typscript. So I have the following: enum ProductAction { PURCHASE = 'PURCHASE', } @Patch('products/:uuid') async…
Mike M
  • 4,879
  • 5
  • 38
  • 58
2
votes
1 answer

How to handle different configurations for each module using Nestjs Config

I want to have different config for each module like specified here But I am not able to achieve this, here is the issue that I am facing: https://github.com/nestjs/config/issues/947
All2Pie
  • 310
  • 3
  • 13
2
votes
2 answers

configService.get() cannot read env variable from .env file in NestJS

I am trying to set TypeOrm configuration object using env variables in NestJS. The configuration object should read 'DB_NAME' env variable(set to db.sqlite) set in a .development.env file. The env variable is provided via configService.get('DB_NAME)…
Aadil
  • 146
  • 6
2
votes
0 answers

NestJs - When intialize the other request in intercept, should I use concatMap or mergeMap

In developing NestJs Interceptor, before call next.handle, there is other request musted be called, so nested Observable should be applied. My question is should I use concatMap to deal with the nested observable or mergeMap would be better in the…
pifuegtq23
  • 171
  • 2
  • 10
2
votes
0 answers

NestJS - Is any different to implement Client service without OnModuleInit

https://github.com/stephenh/ts-proto/blob/main/NESTJS.markdown From the ts-proto protject, in the document, I see the client is implemented with OnModuleInit like this import { HeroById, Hero, HeroServiceController, HeroesService, HERO_SERVICE_NAME,…
pifuegtq23
  • 171
  • 2
  • 10
2
votes
1 answer

Getting error while using env variables as ConfigService in NestJs

i'm using nestjs for project i have no issue using "@nestjs/config" before version 1.1.2 but when i created new one while copy paste from my old source code into my new one especially in main.ts it gives me error Argument of type 'string' is not…
2
votes
2 answers

ConfigService of nest cannot pull .env variable

I wanted to implement the ConfigService of Nestjs v8.1.1 I've place the .env file in the project's root (not src folder) and the file has this content: HOST=http://localhost PORT=8088 The app.Module.ts is enriched with the import: @Module({ …
feder
  • 1,849
  • 2
  • 25
  • 43
2
votes
3 answers

How to fix CORS Error when using the Nest JS framework

I added cors package in the main.ts. but still it's throwing error. I don't understand why this error throwing can you pls explain how to properly handling cors issue. Main.ts const app = await…
hari prasanth
  • 716
  • 1
  • 15
  • 35
2
votes
1 answer

nest build fails because of ts errors in @nestjs/config

I am getting multiple errors about @nestjs/config, leading npm build command to fail but npm run start:dev despite showing errors is working properly. below are the screenshots from the errors and the environment.
Soroush Ahrari
  • 503
  • 5
  • 13
2
votes
0 answers

NestJs microservices architecture common code with separated docker and env files: Monorepo or TS config + Nest cli config?

What is the best solution for common code in the NestJS microservices project? Is: microservices (communication via REST API) with self-sufficient packages, docker and env files, utils + interfaces + DTOs + etc Need: to have utils + interfaces +…
kosiakMD
  • 923
  • 7
  • 22
2
votes
2 answers

Nestjs | ConfigModule | Use (or inject) a service inside `validate` function

import { validate } from './env.validation'; @Module({ imports: [ ConfigModule.forRoot({ validate, }), ], }) export class AppModule {} How can I use some service from within validate function? For example a Logger service? Can a…
fmagno
  • 1,446
  • 12
  • 27
2
votes
0 answers

Nestjs, I can't access my environment variables from my static function of the module

I want to create a dynamic module with Nest.js, this module aims to provide a variable, initialized in this function, in the rest of my application. This variable must be initialized according to my environment variables, which are stored in an .env…
1 2
3
13 14