Questions tagged [nestjs-config]
196 questions
1
vote
1 answer
NestJS: Global exception filter not catching anything thrown from a Kafka-based microservice app
We're using NestJS as our Typescript framework for a microservice based architecture.
Some of our deployments are what we call "Kafka workers", pods that run code that doesn't actually expose any REST endpoints, rather only listens to kafka topics…

Maor Barazani
- 680
- 3
- 12
- 31
1
vote
1 answer
Reading PORT number from .env file in nestjs
I have details defined in .env file. Below is my code.
import { Module } from '@nestjs/common';
import { MailService } from './mail.service';
import { MailController } from './mail.controller';
import { MailerModule } from…

Shruti sharma
- 199
- 6
- 21
- 67
1
vote
1 answer
Nest - Nest can't resolve dependencies
I have a very simple CryptoModule that looks like this:
import { Module } from '@nestjs/common';
import { CryptoService } from './crypto.service';
@Module({
providers: [CryptoService],
exports: [CryptoService],
})
export class CryptoModule…

Kristijan Stefanoski
- 262
- 1
- 4
- 14
1
vote
1 answer
How to init RouterModule with variable from ConfigService?
I want to use the RouterModule.register(arrayOfRoutes), but I need to build the arrayOfRoutes with a variable from the ConfigService.
What is the proper way to do that ?
Thanks for the help ! ;)
// current state, appRoutes is not customizable.
//…

Seraf
- 109
- 1
- 9
1
vote
3 answers
How to integrate Heroku with Google Cloud SQL (native - GCP) in Nestjs/Typeorm?
I'm currently really frustating cause cannot deploy my app to Heroku and connect my db to Google Cloud SQL.
What am I already did?
I have been set up SSL to connect them
I have been set up Cloud SQL Auth Proxy (+ set up Cloud SQL CLient role in IAM…

Pandhu Wibowo
- 182
- 8
1
vote
2 answers
Dynamic environment not loading in NestJS ConfigModule
I have a REST API server in Nest Js. I am trying to separate the environment for test and production.
ENV files are .env.test and .env.production.
script:
"start:test": "SET NODE_ENV=test && nest start --watch"
app.module.ts:
@Module({
imports:…

Shashank Dubey
- 353
- 1
- 6
- 17
1
vote
0 answers
NestJs - CLI Plugin - enabling the Swagger plugin for npm dependencies
I created a npm DTO library used on different projects (front / back)
On the back side, I use NestJs and I would like to activate the Swagger CLI-Plugin of NestJs (https://docs.nestjs.com/openapi/cli-plugin) on the created library, any idea how to…

Ugo Evola
- 546
- 3
- 8
- 19
1
vote
0 answers
Rename property in a json body
I am using NestJs to create an API, I currently have an endpoint post that receives parameters, processes it, and responds. The problem I have is that I want to change the name of a parameter, but only at the Json level, I tried with the Expose…

normeno
- 105
- 1
- 10
1
vote
2 answers
NestJS Serialization - how to instantiate default values
I have the following classes and enum in one of my nestjs service
export enum Gender {
MALE = 'M',
FEMALE = 'F',
}
export class Address {
address1: string = '';
address2: string = '';
address3: string = '';
city: string = '';
…

user08152017
- 122
- 9
1
vote
3 answers
Nestjs: Unable to connect mongo asynchronously
I am unable to connect to mongodb asynchronously. Please let me know what am I doing wrong.
MongoConfig file:
import { MongooseModuleOptions } from '@nestjs/mongoose';
export default (): { mongoConfig: MongooseModuleOptions } => ({
mongoConfig:…

Sachin Yadav
- 128
- 3
- 12
1
vote
3 answers
Nestjs | Setting the log levels using ConfigService
How can I set the allowed log levels by using the ConfigService?
I tried to do it through main.ts but the logLevels are set during the app creation call which is also required to get the ConfigService.
const app = await NestFactory.create(
…

fmagno
- 1,446
- 12
- 27
1
vote
1 answer
How to get values from custom configuration file in Nestjs with interface?
I'm trying to set up all of my configurations in one file in "config.ts", load it to ConfigService and then with config interfaces get values from it.
So here is my config.ts that have ENV vars from my .env file and static variables.
UPD: Made repo…

Denis Penkov
- 23
- 1
- 4
1
vote
1 answer
How to implement e2e testing in Nest JS Framework
I am new this Framework. I implemented crud operation, migration, unit testing also but I do know how to implement e2e testing in nest JS Framework. I tried to run the e2e testing program it's throwing an error
How to fix this error. I tried many…

Hariprasath Vengatachalam
- 155
- 6
- 18
1
vote
0 answers
nestjs configuration with multiple files
By default, nestjs uses a config package and wraps it with a high-level abstraction. I have a config folder, with development.ts and production.ts files, and if use config package directly, one of those config file loads by config automatically…

RobertoCarlos
- 31
- 4
1
vote
1 answer
Cannot access to a service exported from a module that is provided by a shared module when using ClientsModule.registerAsync()
The context is that I have created a shared config module that imports multiple config modules, each config modules are exporting their own service, the shared module exports each imported module, for the moment in my app i have the app module that…

Julien METRAL
- 1,894
- 13
- 30