serverless-http icon indicating copy to clipboard operation
serverless-http copied to clipboard

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

Open destroyer22719 opened this issue 1 year ago • 0 comments

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

destroyer22719 avatar Apr 25 '23 20:04 destroyer22719