Questions tagged [nestjs]
Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with and fully supports TypeScript.
11,942
questions
0
votes
0
answers
16
views
Can't connect to Websocket from a Backend Application
I'm trying to create a proof of concept and send a message to Websocket made with Spring everytime a hit a specific endpoint in an Api Rest made with NestJs.
For this, I created the following ...
0
votes
0
answers
11
views
How to merge application resolvers with dynamic resolver in NestJS using ApolloFederationDriver
I am developing an application that requires dynamic schema using NestJS and the Apollo GraphQL module that comes integrated with it. To achieve this, I am creating type definitions and resolvers ...
-4
votes
1
answer
29
views
Cannot read properties of undefined (reading 'create')?
I want to get posts from Vk and add them to postgressQl. But hapenning nothink:
What I do wrong, and how can I add Posts to My datsBse.
I could get Posts and I see them.
Entity:
@Entity('tutors')
...
0
votes
0
answers
11
views
Using subdomains in NestJS with Fastify Adapter?
The docs state that Fastify doesn't support nested routers, however they do support a Route Config which in theory should allow me to use constraints to limit a route to a sub domain, such as the ...
0
votes
0
answers
9
views
Uploading with NestJS and Multer doesn't work
I'm trying to upload files with nesteJS and Multer according to this documentation : https://docs.nestjs.com/techniques/file-upload
In my app.module file I have the following configuration::
In the ...
0
votes
0
answers
9
views
NestJS + Pino Logger appears only partially
I have implemented the Pino Logger (iamolegga/nestjs-pino) like described in the documentation, into my NestJS application. And I can see the startup messages like route mappings and controller ...
0
votes
1
answer
66
views
Multiple DB Connections are getting Created In MongoDb
I have to do real time changes in my site. I'm using Nest.js and server sent Events and change streams for real time changes.
Client Will call My SSE API passing some required information in query ...
0
votes
0
answers
15
views
Handle redirection from an api : going back properly
On my NestJS server, I am implementing an authenticate method using an API. Here is my user's route:
export class AuthController {
constructor(private authService: AuthService, private userService:...
0
votes
0
answers
11
views
NextJS with NestJS Backend Set-Cookie header is ignored by browser
I have a backend NestJS/Fastify app and a NextJS 13 frontend.
I use a client component to signin to my app, and in my devtools, I see the Set-Cookie header in the response.
// backend auth route
@...
-2
votes
1
answer
33
views
Where does the name posterManID come from?
I am doing a NestJs server with TypeORM and I have a problem with the posterMan attribute. It is Null but I want the data of the author.
The part from MySQL table where it shows the name posterManId:
+...
0
votes
2
answers
12
views
NestJS problem with entering secret key normally but not finding value
I'm making JWT token inssuance function now.
but when i try to get token by login, the error occus like below:
"Error: secretOrPrivateKey must have a value\n at Object.module.exports [as sign] ...
0
votes
0
answers
11
views
Multiple call logs being stored from cdr event in Asterisk while transfering call
While transferring a call, the lifespan of a call throws 5 different cdr events. One from queue and other acts as an inbound call.
this.ami.on('cdr', async (evt) => {
if (evt.source == '//...
0
votes
0
answers
5
views
Passing Query or Params to Google Auth routes
the flow i want to implement is that first i will ask the user if he is a company or a candidate. when he choose one, then he will be shown relevant register forms. after then there will be buttons to ...
0
votes
0
answers
17
views
NestJS Guard fails, action still executes
I've inherited a problem in a NestJS project where a guard has been setup to check for a JWT but the guard doesn't work correctly and I'm really struggling to figure out why. From what I can see in my ...
0
votes
0
answers
19
views
connect to redis server in nestjs
I tried to connect to the Redis server, this server is not my local
but I have this error
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
...
0
votes
0
answers
10
views
Implementing GraphQL stitch with RabbitMQ in NestJS
I'm working on a NestJS task where I must use GraphQL stitching with RabbitMQ. I actually have explored various options, however am having trouble finding clean and exact commands on a way to obtain ...
0
votes
1
answer
21
views
Redis: How do I expire items from a sorted set after 24 hours?
I was using Redis in my NestJs app and was pushing certain values using zadd.
I wanted to know how can I set an expiration time for each item pushed into the set and expire them after 24 hours.I tried ...
0
votes
0
answers
23
views
What TS type do I use for the `code` property when detecting a duplicate value exception in NestJS/TypeORM?
I am using NestJS with TypeORM and a Postgres database.
I have set up an entity to have a unique username column, like this:
@Entity()
export class DataEntity {
@PrimaryGeneratedColumn('uuid')
id: ...
0
votes
0
answers
13
views
Can I send timer, when timer time is equal 0 via a Websocket Gateway in nestJS
Through postman I connected to the timer-update event, but still I do not receive the timer object when time = 0
time.service.ts
@Cron(CronExpression.EVERY_SECOND)
async updateRemainingTime()...
0
votes
1
answer
26
views
NestJS creates wrong query (duplicated parameters)
NestJS using typeORM is creating SQL query with duplicated parameter, and fails the call.
The big mystery is that two different nodes with the same code behave differently (each time only one of them ...
0
votes
0
answers
11
views
Nestjs: No type definitions were found with the specified file name patterns: \"./**/*.graphql\"
im trying to deploy Nestjs with Graphql backend server on Vercel, I am using schema first approach so there is a schema.graphql and graphql.ts in my src folder, you can see my code below, im following ...
0
votes
0
answers
36
views
@nestjs/swagger: Not Adding Example and Status Code from within applyDecorators
I have had quite a bit of trouble getting my docs to update. Here is a small example:
// export-decorators.ts
export function ApiOkAndErrorResponses() {
return applyDecorators(
HttpCode(200),
...
0
votes
1
answer
17
views
Not able to use socket.io in nest js and react native ( expo )
am trying to implement a real-time functionality in my mobile app ( React native Expo ), am using NestJs as a backend and bellow is my gateway, but the connection is not happening for some reason. ( ...
0
votes
1
answer
17
views
Providing Providers to Dynamic NestJS Modules
How Can I use export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new ConfigurableModuleBuilder<ConfigModuleOptions>().setFactoryMethodName('createConfigOptions').build(); to ...
0
votes
1
answer
8
views
Overload 1 of 2 on CASL can method
Hi I'm creating CASL auth in my nest app. Unfortunately i have this error on Action.Update
can(Action.Update, selectTeamSchema, { createdById: user.id });
No overload matches this call.
Overload 1 ...
0
votes
0
answers
18
views
Exclude() is not working on nestjs post method response but working on get response
user.entity.ts
@PrimaryGeneratedColumn('uuid')
id: string;
...
@Column()
@IsString()
@Exclude({ toPlainOnly: true })
password: string;
user.controller.ts
@Post()
async create(@Body() createUserDto: ...
0
votes
0
answers
17
views
How to query different postgres schemas with nestjs and typeorm?
I am setting up a project with NestJS, Typeorm, and Postgres. I want to work on different schemas based on the environment. In my local, I will have development and test. I could add the migrations by ...
0
votes
1
answer
29
views
NestJS: class-validator Not Throwing Validation Errors for Casted Objects
To start with the example code:
// anniversarycredits.dto.ts
export class AnniversaryCreditsDto {
@IsNumber()
@ApiProperty({
description: 'The amount of credits to award on anniversary.',
})...
1
vote
1
answer
25
views
function st_geomfromtext(unknown) does not exist PostGIS
I have this query:
SELECT
name, location, date, price_type, price, currency, category, amount, id
FROM
jobs
WHERE
status = 'ACTIVE'
AND CAST(category AS TEXT ) IN $...
0
votes
0
answers
14
views
NestJs Segmentation fault
I have a segmentation fault randomly happening when working on my nestjs project, the segmentation comes once in a while, there is day where the segmentation fault comes and days where the seg fault ...
-1
votes
0
answers
24
views
How to mock `createQueryBuilder` in NestJS tests?
I have this NestJS service method which I need to test.
async getAllTests(orgId: string): Promise<Array<TestEntity>> {
try {
const query = this.repo.createQueryBuilder(this.tableName)...
0
votes
0
answers
14
views
@nestjs/mongoose create connection every request
I create connection by forRootAsync like bellow
@Module({
imports: [
MongooseModule.forRootAsync({
useFactory() {
return {
uri: `mongodb://127.0.0.1:27017/myDb`,
}...
0
votes
2
answers
24
views
Prisma raw query return number instead of found value
This is the query that I am executing
const jobs = await this.prisma.$executeRaw`
SELECT
name
FROM
jobs
WHERE
status = 'ACTIVE'`;
but instead of getting the results that macth this query I ...
-1
votes
1
answer
26
views
How to test calls to NestJS Logger?
I have a NestJS project I am trying to add tests for a service. I need to test and verify the calls to the Logger to make sure it logs as expected.
My test.service.ts file is set up like this
@...
0
votes
0
answers
21
views
NextJS middleware no cookie sent to the NestJS backend
I'm using NextJS as my frontend and NestJS as my backend, I'm trying to check if the session id is valid, i'm sending a request inside my NextJS middleware to my backend, the request is reaching my ...
0
votes
0
answers
22
views
Update Unauthorized with Angular and Nestjs
I'm trying to send the data of this form to database, my backend funtions ok, but my frontend have a problem which show in code bellow.
it's a wrong that i have when i try to save that in the database
...
-2
votes
0
answers
16
views
Error TS2322. when building restful Backend api with nestjs
error TS2322: Type '{ userId: number; title: string; description?: string; url: string; }' is not assignable to type '(Without<NoteCreateInput, NoteUncheckedCreateInput> & ...
0
votes
1
answer
26
views
Is that a way to use elastic search replace the specific field data to null when retriving search result?
I need to use elastic search in nestjs to query to retrieve some result from index.
Requirements: I need all results including access_level: "Restricted" and access_level: "...
0
votes
0
answers
14
views
serving an image file on NestJS always gets 404 error
I'm working on NestJS. I want to serve image files to clients. But it is not working.
Here is my project structure.
/MyProject
/src
app.module.ts
..
/uploads
myimage.png
The ...
0
votes
0
answers
20
views
Send email via Nodemailer in NestJs with html template that is uploaded in Mailgun
I have this very simple template uploaded to my HTML templates at mailgun
<!DOCTYPE html>
<html>
<head>
<title>Your Email</title>
</head>
<body>
...
0
votes
1
answer
13
views
File validator always return error even the file type is correct - NestJS
I'm working on NestJS. I want to upload image files through the API. I added the validator in the API but it is not working. Here is my code,
@Post('upload')
@UseInterceptors(
FilesInterceptor('...
-1
votes
0
answers
17
views
The "swagger-ui-express" package is missing in NestJS project
I have met the tips when I build NestJS project. nest build is OK, but nest start was failed.
env file path = .env.test
[Nest] 83540 - 09/28/2023, 4:06:46 PM [NestFactory] Starting Nest ...
1
vote
0
answers
20
views
NestJs can't inject services into authguard
As the title of the post says, I can't inject service in the following authguard class, I get an error each time I try to, the error happens in the JwtAccessTokenGuard where I try to inject the ...
0
votes
1
answer
21
views
How to query prisma for a custom condition in NestJS
I have this query
const jobs = await this.prisma.job.findMany({
skip,
take: limit,
where: {
userId,
customConditionHere <=====,
},
select: {
...
0
votes
0
answers
14
views
Is it able for NestJS to show show the error with description?
I'm new to NestJS. I normally dev on JAVA but I need to go with NestJS due to the project requirement. I'm using NestJS + TypeORM + SQLSERVER.
When I test on my code, I got the SQL ERROR like this,
...
0
votes
0
answers
20
views
Can't retrieve cookie in vueJS frontend from NestJS backend. Doing Oauth authentication
I'm trying to setup an Oauth authentication but I can't retrieve any cookie in the frontend. Here is my stack:
vueJS (frontend)
nestJS (backend)
passport (Oauth)
prisma (ORM)
postgreSQL (DB)
vuetify (...
0
votes
0
answers
10
views
Implementing permission-based access role in NestJS
I'm working on a NestJS project which requires Permission-based access control.
Most of the functionalities are covered. User's permissions are tied to every request. Routes (or controllers) are ...
0
votes
0
answers
12
views
Nest Js, How can I apply a web socket adapter on onModuleInit?
Can I inject INestApplication into a module?
I want to access the app instance inside onModuleInit to use a web socket adapter
I thought I could get the app instance using HttpAdapterHost
const ...
0
votes
0
answers
28
views
How to fetch multiple images of any given format from nestjs backend that can be rendered on postman for testing
I am trying to make a service where a user can search for images. The service can handle all the image formats. It should return the images based on the search keyword provided. The result can be ...
0
votes
0
answers
18
views
How to properly test a NestJS Repository?
In my NestJS project I am using the repository pattern and postgres as my DB.
I have this organization.repository.ts (only showing 2 methods here)
import { DataSource, Repository } from 'typeorm';
...