Closed GimignanoF closed 4 years ago
Hey - when you converted the ESM imports to CJS require's, you made a slight mistake, which was the cause of this. Here's the fix:
https://github.com/GimignanoF/mongo-graphql-starter-fastify-lambda/pull/1
I urge you to leave the ESM stuff alone, and just use the esm package (from npm) to consume them directly, in Node.
Re
I also noticed that using the example code for MongoConnection, the mongoPromise gets called on each request, which I don't know if is normal or not
Whatever promise you provide, will be resolved (await
'd) for each request - that's by design. I don't immediately see any problems with that - did you have any specific concerns?
I'm closing this, but feel free to respond.
Thank you for the fix via PR, I'll check asap. For the mongo connection i figured it out, i was just not reusing an existing open connection :)
I'm having some troubles integrating this package with a Fastify Server running in AWS Lambda. I'm using the example schema to generate everything, however when i run the server locally i get this error
Book.Query defined in resolvers, but not in schema
I also noticed that using the example code for MongoConnection, the mongoPromise gets called on each request, which I don't know if is normal or not. By the way, I've setup an example project to replicate this bug. Note that I've changed all "import ... from ..." to "const ... = require(....)", so it may be just that but I need to have the generated classes in this format
The example repository can be found here, in the Readme file there are the instructions to make it running https://github.com/GimignanoF/mongo-graphql-starter-fastify-lambda