dougmoscrop / serverless-http

Use your existing middleware framework (e.g. Express, Koa) in AWS Lambda 🎉
Other
1.71k stars 164 forks source link

Cannot work with graphql, express-graphql or graphql-http #275

Open destroyer22719 opened 1 year ago

destroyer22719 commented 1 year ago

I am trying to migrate my application from REST to GraphQL but I encountered a problem. Whenever I run a query in which it works perfectly fine like normal it returns the results I want. But when I use serverless-offline or deploy it on AWS Lambda it doesn't work. I get this error:

{
    "errors": [
        {
            "message": "Must provide query string."
        }
    ]
}

I currently use graphql-http in my nodejs and express application and after trying out the deprecated express-graph package it has the exact same problem. You can clone the below GitHub repository and use serverless offline to run it and see for yourself.

you can run the below

query {
    hello
}

in which the result should be

{
    "data": {
        "hello": "Hello world!"
    }
}

I noticed there is an issue that is still open but no update from the developer yet regarding this issue in which he said he'll look into it later and it's been 2 years: https://github.com/dougmoscrop/serverless-http/issues/140