graphql icon indicating copy to clipboard operation
graphql copied to clipboard

Shouldn't require/execute resolvers.js when deploying the built in resolvers lambda

Open hypexr opened this issue 4 years ago • 4 comments

Unexpected errors can occur when resolvers.js is loaded as part of the deploy process.

For example, it's common to create things like DB connections outside of the handler so that they persist as long as the lambda is running without being recreated on each call. Another thing that I'm experiencing is that I instrument my lambdas with aws xray and that loads and instruments http which can errors.

If this require was replaced with a fs read file and it was parsed differently it would still be possible to determine the keys under Query and Mutation.

hypexr avatar Aug 12 '20 23:08 hypexr

how could it be parsed differently? AST? 🤔

eahefnawy avatar Aug 26 '20 06:08 eahefnawy

Woah, never heard of AST before, but looks like a perfect fit.

hypexr avatar Aug 26 '20 16:08 hypexr

Using AST is low-level and complicated, so I don't think it'd be worth it for this use case. I was hoping you could share what you mean by "parsing differently" because AST is the only thing I could think of? 😅

eahefnawy avatar Sep 01 '20 10:09 eahefnawy

Right, I don't know of a better way, but it does seem like AST is appropriate for this problem. Otherwise it should be specified in a configuration file.

hypexr avatar Dec 30 '20 21:12 hypexr