#fastify file upload

2 messages · Page 1 of 1 (latest)

rustic tundra
#

I have Nestjs and fastify app, But when i post a request with multipart body
I am getting this error in the file
Main packages used: Zod, @fastify/multipart

    // main.ts
    app.register(multipartPlugin, { attachFieldsToBody: true });
    // Dto
   export class CreateStoreDto extends createZodDto(
  StoreModel.pick({
    city: true,
    country: true,
    description: true,
    name: true,
    phoneNumber: true,
    userName: true,
    themeId: true,
    currencyId: true,
  }).strict(),
) {}

Error summary in addition to zod errors

[Nest] 18928  - 10/10/2023, 3:57:00 PM   ERROR [ExceptionsHandler] Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'name' -> object with constructor 'Object'
    --- property 'fields' closes the circle
quick sable