12,854
questions
0
votes
0
answers
12
views
In NestJS, service is invalid when injected to another service?
I`d like to develop a rest app by NestJS and MikroOrm. And I prefer to use clean architecture to manage code, so a lot of modules are abstracted and a module need to be import to another module.
What ...
0
votes
0
answers
7
views
Handling redis channels and messages with promises (ioredis)
I'm working on a NestJs API using ioredis's channels and messages as a part of a microservice architecture.
In my main code, I want to wait until I receive a message from a redis channel, so I thought
...
0
votes
1
answer
22
views
Querying associated record fails "Cannot read properties of undefined (reading 'joinColumns')", not loading inverse relation in TypeORM in NestJS app
Well I see a very similar problem here, sadly there was no definitive answer:
TypeORM & NestJS: TypeError: Cannot read properties of undefined (reading 'joinColumns')
Summary
I have an ...
0
votes
1
answer
19
views
Should this HTTP contract class be considered a repository, service, or just an HTTP client?
I'm looking for some advice or best practices for a pattern we're discussing internally.
We have a class (example below) that defines an HTTP contract to interact with an external REST API. The class ...
0
votes
0
answers
14
views
Kafka partioning key difference between Python and Nestjs
In my infrastructure I have multiple microservices with multiple language communicating over Kafka. In my Kafka I have multiple partitions and to keep consistency I use a key when I push messages so ...
0
votes
1
answer
16
views
How to fix typescript error @types/express-serve-static-core/index has no exported member
I'm facing these errors after changing node from 14.18.0 to 20.16.0:
../node_modules/@types/express/index.d.ts
node_modules/@types/express-serve-static-core/index"' has no exported member '...
0
votes
0
answers
11
views
How to manage version compatibility between microservices and external packages in NestJS?
We have several microservices running on different versions of NestJS—specifically versions 8, 9, and 10. Additionally, we use external modules, such as an Auth module, which is located in a separate ...
0
votes
1
answer
14
views
beforeSoftRemove hook not updating database entry using Nest.js and TypeORM
I want to implement a solution in Nest.js and TypeORM application that every record that is getting created should have createdById, updatedById and deletedById against their actions. Let me share the ...
0
votes
0
answers
14
views
TypeORM can not order by on addSelect field
I have this code block:
async getReceiptsForTimeline(
userId: string,
getTimelineInput: GetTimelineInput,
): Promise<ReceiptCursorBasedPaginatedResult> {
const { cursor, take = 10, ...
-1
votes
0
answers
13
views
Is it node js express or nestJs fastify better to use concurrency, scalling, performance, large data fetching and saving side? [closed]
give me advantages and disadvantages with the result previously used POC's mainly i'm facing issue concurrency and scalabitity issue with large number of data. so i need to select proper framework to ...
0
votes
0
answers
21
views
Nest.js microservices with TCP transporter
I was reading microservices section in the nest.js documentation. As doc mentions, there are two ways to transmit messages with transporters: 1-request-response and 2-event-based
Most transporters ...
0
votes
0
answers
16
views
NestJs Cron Jobs Which Previously Worked Are not Functioning
We're using NestJS scheduler for cron jobs, we've had a certain amount of cron tasks which have been running without any issues in production. However we've recently doubled the amount of cron tasks, ...
0
votes
0
answers
21
views
Memory leak in NodeJS (NestJS) when saving application logs
I have a server application written in NodeJS (NestJS). The application uses a tracer to store nested logs, and my problem is that creating an instance of the logger class leads to a memory leak.
The ...
-1
votes
1
answer
17
views
Access to XMLHttpRequest at 'http://localhost:3001/auth/register' from origin 'http://localhost:3000' has been blocked by CORS policy:
Hi I am using NestJs to build Api endpoint and NextJs for Authentication system I got this error when submit a form form Nextjs:
Access to XMLHttpRequest at 'http://localhost:3001/auth/register' from ...
0
votes
0
answers
26
views
NestJS GraphQL Federation 2, problem with @ResolveReference between two services
I need help.
I currently have nestjs graphql microservices (apollo) federated via a nestjs gateway (appollo gateway).
The types are shared between the services via a library that shares the types (I'm ...
0
votes
0
answers
24
views
Dependency (upstream) services are undefined with no useful error when doing e2e testing using Jest
This is in NestJs, using Jest. I am trying to test my controller, which relies on my "main" service. I wish to perform e2e testing on the controller. (To clarify, my smaller unit tests of ...
0
votes
0
answers
19
views
How to Increase Prisma Connection Pool Size on a RDS Instance?
My team is running a PostgreSQL database on an AWS RDS t3.micro instance with 2 vCPUs and 1GB of RAM. When we deploy our backend (NestJS with Prisma ORM) on ECS, we notice the following log:
prisma:...
0
votes
0
answers
16
views
How to get authInfo in the callback's request?
I'm using passport and google oauth strategy using session, and the authentication works fine, the issue is that based on the authInfo, I need to redirect to a different URL. If it's a new user, ...
-1
votes
1
answer
37
views
How to add random data to postgresql table with relations
I'm using postgresql, nestsj, typeorm i pgAdmin4. I have an entity with some columns and relations. I want to add random rows to this table, ideally with some relations, also randomly populated. Is it ...
0
votes
0
answers
31
views
Errors raised in the BodyParser middleware not propagated to interceptor
I have a NestJS application that is using the express' built-in BodyParser middleware to limit the request size. I've created a global interceptor to transform various errors and exceptions, and have ...
0
votes
0
answers
11
views
not able to use pre save mongoose hook in nestJs
I have an use case in which before saving a document I need to check if the document is a valid document to be saved based on condition.
To deal with it I am trying to use pre save mongoose hook. But ...
0
votes
2
answers
51
views
I'm having trouble configuring CORS
I'm working on a frontend application using React with Redux and a backend in NestJS with Firebase. I'm facing a CORS issue that I can't seem to resolve. I've configured CORS on the backend, but I'm ...
0
votes
0
answers
17
views
issue configuring internal packages with turbo build and using this with nestjs
I've a turbo repo configured with Nestjs, now I need include a shared package so I'm using an internal package, in my root package.json I included
"packages/*"
I'm using the tsconfig from ...
-2
votes
0
answers
25
views
How to refactor modules / services to avoid coupling? [closed]
I have been working with a startup for about 1 year now, developing a pretty big application from scratch ; I am the most senior developer here, and I've pretty much developed the backend on my own. ...
0
votes
0
answers
62
views
JavaScript Heap Out of Memory Error: Allocation Failure
I'm using NestJS with Node.js version v20.12.1, and every time I run my project, I encounter an "insufficient memory" error. I'm not sure where this issue is coming from. Can you help me ...
0
votes
0
answers
39
views
Create a history table and keep track of all the updates to a document
I have a NestJS application that uses mongoose and MongoDB. I need to capture all changes/versions of this document so that I can display this as a history of the document, what changes were made by ...
0
votes
1
answer
20
views
Constructor-based injection vs Property-based injection which to use?
Should I use Constructor-based injection or Property-based injection or follow different approach.
interface Human {
eat(): void;
sleep(): void;
}
@Injectable()
export class EmployeeService ...
0
votes
1
answer
40
views
NestJS Mongoose Connection Error: "MongooseServerSelectionError: connect ECONNREFUSED ::1:27017" [duplicate]
I'm working on a NestJS application that connects to a MongoDB database using the Mongoose module. Everything was working fine until I encountered the following error:
[Nest] 3372 - 08/24/2024, 9:32:...
0
votes
1
answer
49
views
How Scope works in Nest js
As per docs if a service is a request scope then the controller depends on it and will be request scope automatically.
Imagine the following dependency graph: CatsController <- CatsService <- ...
0
votes
0
answers
34
views
Invalid Signature when I try to join zoom meeting
I want to join zoom meeting from my reactjs app using zoom sdk.
I have downloaded zoom sdk code from internet and it is working using nodejs and reactjs.
But In my app I have reactjs as frontend and ...
0
votes
1
answer
58
views
Proccess dates in nest.js and typeOrm
I got this table:
Id
date_time_capture
idHive
1001
2024-06-19 20:17:45
2
1002
2024-06-19 20:18:45
2
date_time_capture is a datetime field in my database using MySql then in postman:
This is my ...
-1
votes
1
answer
30
views
Unexpected behaviour in NestJS / NATS microservice
I have a NestJS app that uses NATS microservices (using NatsJetStreamTransport). In one microservice I have a controller (A) with following event listener:
@EventPattern("businessRule.apply")...
0
votes
0
answers
31
views
How to run a Nest.js scheduled function in a different timezone?
I'm struggling getting timezones and task scheduling work properly on a Nest.js 9 project. For reference, this is the docs for the library: https://docs.nestjs.com/v9/techniques/task-scheduling
This ...
0
votes
0
answers
20
views
WebSocket Connection Issue with ECS Container Behind API Gateway
We are currently facing an issue with establishing a WebSocket connection to a server hosted in an ECS container within a VPC.
Our cloud infrastructure is set up as follows:
UI → AWS API Gateway → ...
0
votes
1
answer
78
views
What is the correct way to deploy a nest js app in a azure web app server? Should the package.json be included?
The nest js build it's not including the package.json which seems to be normal, but then when deploying to azure web app, the server it was not capable to install the needed packages. Finally I have ...
-1
votes
0
answers
10
views
EsLint line break issue resolve in nestjs
Eslint issue `endofLine break ` while integrate in to nestjs project. The issue was resolved by adding the configuration below.
Add some configuration inside .eslintrc.js file
'prettier/prettier': [
...
1
vote
2
answers
35
views
Guard in NestJs isn't work when i give it globally
I'm using an AuthGuard component globally in my NestJS application to protect routes, while allowing some routes to be public using a Public decorator. However, the guard isn't functioning as expected,...
-2
votes
0
answers
45
views
Is it good use multiple repositories in one service? [closed]
How to structure service interactions with multiple repositories in NestJS for different payment types (subscription and one-time payment)?
I'm developing a NestJS application and need to implement a ...
0
votes
1
answer
24
views
ERR_PACKAGE_PATH_NOT_EXPORTED when file-type used in nest.js
I'm using file-type in nest.js and I've this error, using the last 19.4.1 version.
nest start
node:internal/modules/cjs/loader:597
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No &...
0
votes
0
answers
14
views
How to Sum and Map Counts of Two Related Entities in TypeORM QueryBuilder?
I'm working on a TypeScript project using NestJS and TypeORM. I'm trying to build a query that retrieves a list of "tasks" with the following requirements:
Count the number of "...
0
votes
1
answer
40
views
Can't Connect to Redis in Docker with NestJS
I am trying to connect to a Redis instance running in a Docker container from my NestJS application. However, I'm encountering connection issues when using the URL for the Redis connection. When I ...
0
votes
1
answer
35
views
Correct param decorator usage
I am wondering if I am implementing correctly a controller action to parse a parameter from URL in Nest.js
In my AppController class I declared a function getUser
@Get('user/:id')
async getUser(@...
0
votes
1
answer
20
views
UnknownElementException [Error]: Nest could not find DataSource element (this provider does not exis
I am writing an e2e test, the application has type or postgres 2 databases in the configuration, the test is successful, all actions with the database are performed, but when the application is closed,...
0
votes
1
answer
37
views
How do I remove the default value defined by the dto property in the @nestjs/swagger PartialType function?
CreateAdminDto.ts
export class CreateAdminDto {
readonly username!: string;
@IsOptional()
readonly jurisdiction?: string | null = null;
@IsOptional()
readonly nickname?: string;
}
...
-1
votes
1
answer
34
views
Can we have Multiple Interceptor for a single Http method in Nestjs?
Is it possible to have multiple interceptor for a single HTTP method.
for instance we a have a file upload method, where the express fileInterceptor handles.
And I have generalized response structure ...
0
votes
1
answer
33
views
How to Sort Users by Their Last Sent Message Timestamp in NestJS with TypeORM and PostgreSQL?
I'm working on a NestJS application with TypeORM and PostgreSQL, and I need to fetch a list of users sorted by the timestamp of the last message they sent.
I have two entities, User and Message, ...
0
votes
1
answer
31
views
how would you start a nest.js application without `nest start` command?
I use npm publish to pack my application and run node ./dist/index.js to run it inside docker container in production. As nest.js has kind of special command to start, I wonder if I can integrate it ...
0
votes
0
answers
30
views
NestJS not running POST request
I am following a tutorial by Dave Gray and by 29:30 he creates a POST controller as
@Post() // POST /users
create(@Body() user: Record<string, any>) {
return user;
}
When I run this on ...
-1
votes
0
answers
35
views
How to use ParseIntPipe in nest js so it accepts optional values?
I Have the following line of code in nest js, but it does not work as expected.
Even though the optional parameter is set to true, not sending the Year query param fails because of validation.
@Query('...
0
votes
0
answers
21
views
How to fix an error when creating a migration
Error: Debug Failure. False expression: Non-string value passed to ts.resolveTypeReferenceDirective, likely by a wrapping package working with an outdated resolveTypeReferenceDirectives signature. ...