Skip to content

serverless-offline: typedefs being imported many times >.< #443

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

Closed
githubflub opened this issue Oct 15, 2019 · 2 comments
Closed

serverless-offline: typedefs being imported many times >.< #443

githubflub opened this issue Oct 15, 2019 · 2 comments
Labels
Duplicate 🔑 This issue or pull request already exists Question ❔ Not future request, proposal or bug issue Solved ✔️ The issue has been solved

Comments

@githubflub
Copy link

githubflub commented Oct 15, 2019

When I run >serverless offline in my terminal, it creates an http endpoint and a websocket endpoint. I make a request to the HTTP endpoint, type-graphql tries to build the schema but fails with the age old error.

Error: Schema must contain uniquely named types but contains multiple types named "User".

I comment out most of the code in the lambda function that is the websocket endpoint and run serverless offline again. Everything works.

I've narrowed down the issue to the typedefs being "imported" multiple times (probably due to there being either 2 endpoints or 2 functions - currently I have only 1 function per endpoint).

Here is how it looks when it works (imports commented out).
Annotation 2019-10-15 001418
Annotation 2019-10-15 001134

Here is how it looks when I import a typedef from the websocket endpoint. Definitely imported multiple times...
Annotation 2019-10-15 001535
Annotation 2019-10-15 001954

And the error
Annotation 2019-10-15 002428

Maybe this is a question for serverless-offline... What do you guys think? What is the problem with the typedefs being imported multiple times? Is there something I can do to stop this?

@githubflub githubflub changed the title serverless-offline: schema must contain uniquely named types >.< serverless-offline: typedefs being "imported" twice? >.< Oct 15, 2019
@githubflub githubflub changed the title serverless-offline: typedefs being "imported" twice? >.< serverless-offline: typedefs being imported many times >.< Oct 15, 2019
@MichalLytek
Copy link
Owner

Duplicate of #96 #162 🔒

@MichalLytek MichalLytek added Duplicate 🔑 This issue or pull request already exists Question ❔ Not future request, proposal or bug issue labels Oct 15, 2019
@githubflub
Copy link
Author

githubflub commented Oct 16, 2019

Thank you for pointing me in the right direction. The solution here appears to have fixed the problem for me. Except I had to delete the following line from his code.

delete global.typeormMetadataArgsStorage;

#162 (comment)

For anyone wondering, I fixed my typeorm problems with the help of this thread.
typeorm/typeorm#3427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🔑 This issue or pull request already exists Question ❔ Not future request, proposal or bug issue Solved ✔️ The issue has been solved
Projects
None yet
Development

No branches or pull requests

2 participants