A route cannot call as twice: "Error: Cannot apply @injectable decorator multiple times."
@dherault is there a possibility to run a 'clean'-function on every request?
like this: (source inversify.js):
If you run the application multiple times within a shared runtime process (e.g. unit testing) you might need to clean up the existing metadata before each test.
import { cleanUpMetadata } from "inversify-express-utils";
describe("Some Component", () => {
beforeEach(() => {
cleanUpMetadata();
});
it("Some test case", () => {
// ...
});
});
@mattmeye Hey Matt,
I'm having a similar issue using inversify with serverless offline. Have you found any solutions or workarounds while this issue persists?
Edit: To avoid this error I modified my npm script using serverless offline to be:
sls offline start --useSeparateProcesses
Also, I added the following import at the top of each handler file:
import "reflect-metadata";
Hey @EthanTPainter
this is absolutely the same what I did.
Having the same problem. Have you found any solutions?
Most helpful comment
@mattmeye Hey Matt,
I'm having a similar issue using inversify with serverless offline. Have you found any solutions or workarounds while this issue persists?
Edit: To avoid this error I modified my npm script using serverless offline to be:
Also, I added the following import at the top of each handler file: