NestJS

08 Troubleshooting

Fix common NestJS and Anvia integration failures.

Most NestJS issues come from provider initialization, request validation, adapter-specific streaming, or dependency injection boundaries.

OPENAI_API_KEY is required

Validate configuration before constructing provider clients. Prefer a config module for production apps.

Service Cannot Be Injected

Export SupportAgentService from AnviaModule and import that module where your controller lives.

@Module({
  providers: [SupportAgentService],
  exports: [SupportAgentService],
})
export class AnviaModule {}

Validation Returns 500

Validate body input and throw BadRequestException for user errors.

const parsed = SupportRequest.safeParse(body);

if (!parsed.success) {
  throw new BadRequestException(parsed.error.issues[0]?.message);
}

Stream Does Not Flush

Check which Nest HTTP adapter you use. Express examples use @Res() res: Response; Fastify apps need Fastify reply handling.

Long Runs Time Out

Raise server, proxy, and platform timeouts. For reviewer waits, store approvals and resolve them from a decision endpoint.

Next

Add reviewer workflows in Human in the Loop. Related guides: Tool Errors, Readable Streams, and Tracing.