#Issues converting existing express based app to fastify, 404 on POST, empty request on GET

25 messages · Page 1 of 1 (latest)

sharp wren
#

Hello! I am in the process of switching to fastify on an existing code base and am running into several issues. The first is that POST routes which work normally with express return a 404 error with fastify. the second is that GET routes which work with express have an empty request with fastify.

night nacelle
#

Hi there, I'm having exactly the same issue! Did you resolve it in the end?

shy mirage
#

Got a way to reproduce this? I don't see anything that should cuase this

night nacelle
#

Hi, it's actually fine now - I migrated to Fastify today and perhaps something was corrupted with the running server. After restarting it was fine

#

thank you!

muted lintelBOT
#

This post has been marked as resolved. :white_check_mark:
Please read through the conversation and resolution if you are having the same issue, and then re-open the post if you are still having trouble, providing as much extra information as possible.

limpid minnow
#

Hello there, I have been playing around lately with fastify, everything was working fine and was about to make the move until I hit the same issue: 404 on some specific POST routes that I see correctly mapped by RouterExplorer at startup. Everything works fine using express :S. There is nothing particularly troubling around these routes compared to others (working).
@Post('/submitCap/:asset/:id') @UseGuards(JwtAuthGuard) async submitCap(@Param('asset') asset: string, @Param('id') id: string, @Body() capsule: any): Promise<string> {

#

Using @nest-lab/fastify-multer and fastify packages on the same class.
I tried different things but so far no success. Any suggestion?

shy mirage
#

Got a reproduction?

limpid minnow
#

I don't have reproducible code but collected some info

shy mirage
#

Might be helpful

limpid minnow
#

Cannot POST /tangle/submitCap/.......

#

I cannot identify any error pattern, some rely on FileFieldsInterceptor, others don't...

shy mirage
#

Whats the full POST?

limpid minnow
#

@Post('/submitCap/:asset/:id') @UseGuards(JwtAuthGuard) async submitCap(@Param('asset') asset: string, @Param('id') id: string): Promise<string> { return await this.tangleService.purchaseCapsule(id, asset); }

shy mirage
#

The full URL you call

limpid minnow
#

Gotcha. Sorry. http://localhost:3000/tangle/submitCap/54f9d8b560fef513154992908c3cddccab56097be478763080b31048666173746966792064656d6f/234436

shy mirage
#

Okay. Are you getting into that method, or not making it there at all?

limpid minnow
#

Not making it there at all. However, route is properly mapped on RouterExplorer at startup. Exception is raised on AllExceptionsFilter class I register on AppModule class

shy mirage
#

Very interesting. I feel like I'd need a way to reproduce this locally to start digging into it

limpid minnow
#

I am at a loss, tried different things but none worked. No idea why 😒

#

Some extra info to add more details

muted lintelBOT
#

From conversation only, it seems that we won't be able to determine the root cause of the issue.
Please provide a minimum reproduction repository that reduces the issue to only the most basic components while still producing the same error that you're facing. By doing this, we will be better able to help you resolve your issue.