Next up in my whack-a-bug marathon…
I’ve extended HttpException into a custom exception like so:
src/lib/exceptions.ts
import { HttpException } from 'next-api-decorators';
export class CSRFValidationException extends HttpException {
public constructor(message: string = 'CSRF token mismatch.') {
super(419, message);
}
}
I’m able to include it and use it perfectly fine locally, however whenever I build I’m being greeted with this:
201.7 Failed to compile.
201.7
201.7 ./src/lib/exceptions.ts
201.7 Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
201.7 Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation
201.7
201.7 The error was caused by importing 'next-api-decorators/dist/index.js' in './src/lib/exceptions.ts'.
201.7
201.7 Import trace for requested module:
201.7 ./src/lib/exceptions.ts
201.7 ./src/Data/Services/APIService.ts
201.7 ./src/auth.ts
201.7 ./src/middleware.ts
201.7
201.8
201.8 > Build failed because of webpack errors
And I have no idea what to do with this. This seems to be due to something next-api-decorators
is doing but I don’t know how to go about extending HttpException
while avoiding that.
Ideas?