graphql-compose / graphql-compose/graphql-compose-mongoose

Second arg for Resolver xxx should be instance of ObjectTypeComposer

Open
#395 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
706
Forks
98
PR merge metrics
No merged PRs in 30d

Description

This one was obscure and hard to find.

Locally everything worked great, just like our prior existing products that had used this amazing library. Production in our new AWS environment threw the error in the title or similar depending on how we setup the schemas.

Finally after over a week of trying dozens of various alternative setups (all worked locally, failed in cloud environment - aws lambdas) I read the source code. I found the checks are done using
```
if (!tc \|\| tc.constructor.name !== 'ObjectTypeComposer') {
```

The problem is minified code without source-maps will change the constructor name. At least that's my working theory.

This method of checking the type of tc is prone to issues with minification. I think the source maps will fix it, but i'm not 100%. Worst case scenario I'll disable minification for now.

I hope this helps someone else struggling with this.

Once we get this project launched I may open a PR with a fix for this, but for now wanted to get it out there.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.