-
-
Notifications
You must be signed in to change notification settings - Fork 296
Closed
Description
Hi,
The pipe I'm adding to my payload is not being executed:
protected async onBridgeRequest(
@RabbitPayload(ParsePayloadPipe) payload: Payload) {
console.log({ payload }) // payload is just the raw, un-transformed data
}Pipes only execute if added with @UsePipes() at the handler, but then it applies the pipe to all deocrated arguments. I also use @RabbitHeader() to get a header value, and the pipe attempts to run on it as well (which I guess is expected):
protected async onBridgeRequest(
@RabbitPayload(ParsePayloadPipe) payload: Payload, @RabbitHeader('foo') foo: string) {
console.log({ payload })
}So now I just add the pipe to the handler, and check in transform if the argument.metatype matches Payload then I execute the pipe logic, otherwise, I just send the data through as-is. It's very hacky, but the only way I can get this working as desired.
Not sure why the pipe(s) passed through that decorator don't work, as it's part of the NestJS contract with parameter decorators (first data, then pipe(s)).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels