Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Class constructor ApolloError cannot be invoked without 'new' (src/resolvers/deposits.ts:54) #34

Open
ranemihir opened this issue Dec 2, 2020 · 1 comment

Comments

@ranemihir
Copy link
Contributor

I encountered with this error in the docker container logs. It is related to the ApolloError class not being called with the new keyword. But that doesn't actually seem to be the case.

In src/errors.ts (line 25), NonCriticalError class extends the ApolloError class.
In the src/resolvers/deposit.ts (line 54), calls the extended NonCriticalError class with the new keyword. So it should work fine.

Could be a problem with my setup, thought I should report about this.

TypeError: Class constructor ApolloError cannot be invoked without 'new'
at new NonCriticalError (/usr/src/app/src/errors.ts:25:42)
at /usr/src/app/src/resolvers/deposits.ts:54:13
at step (/usr/src/app/src/resolvers/deposits.ts:52:23)
at Object.next (/usr/src/app/src/resolvers/deposits.ts:33:53)
at /usr/src/app/src/resolvers/deposits.ts:27:71
at new Promise (<anonymous>)
at __awaiter (/usr/src/app/src/resolvers/deposits.ts:23:12)
at deposit (/usr/src/app/src/resolvers/deposits.ts:72:16)
at field.resolve (/usr/src/app/node_modules/graphql-extensions/src/index.ts:274:18)
at field.resolve (/usr/src/app/node_modules/apollo-server-core/src/utils/schemaInstrumentation.ts:103:18)
@sidneydobber
Copy link

Setting the .tsconfig's target to "es6" fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants