Skip to content
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

graphql-server-lambda - graphiql not compatible with nodejs8.10 runtime #1042

Closed
nenti opened this issue May 5, 2018 · 6 comments
Closed

Comments

@nenti
Copy link

nenti commented May 5, 2018

graphiql handler is failing with no error message thrown when changing lambda runtime to nodejs8.10

@dhm116
Copy link

dhm116 commented May 15, 2018

We're running graphiql with the nodejs8.10 runtime without any issues that we're aware of - are you able to provide any snippets demonstrating the issue?

Aside from the serverless configuration, this is all we needed to enable graphiql to work with serverless and serverless-offline:

// Avoid using async/promises until apollo-server-lambda/apollo-server-core
// are updated to support async/await
exports.graphiqlHandler = (event, context, callback) => {
  const graphqlHandler = graphiqlLambda({ endpointURL: '/graphql' });
  return graphqlHandler(event, context, callback);
};

@nenti
Copy link
Author

nenti commented May 15, 2018

My failing handler looks like this. Node6 workd node8 fails. Interesting.

return server.graphiqlLambda({
    endpointURL: GRAPHQL_ENDPOINT,
    passHeader: event.queryStringParameters && event.queryStringParameters.auth,
})(event, context, callback)

@dhm116
Copy link

dhm116 commented May 15, 2018

Yeah, that looks very similar....as I mentioned, we're using serverless and deploying to AWS, so here is a representative portion of that config in case it helps:

service: example

provider:
  name: aws
  runtime: nodejs8.10
  region: us-west-2
  profile: user-profile
  stage: ${self:custom.stage}
  endpointType: REGIONAL

package:
  individually: true
  excludeDevDependencies: true

plugins:
  - serverless-webpack
  - serverless-mocha-plugin
  - serverless-offline

custom:
  # Plugin Config
  webpack:
    includeModules:
      forceExclude:
        - aws-sdk
    packager: npm
  serverless-offline:
    port: 4000

functions:
  graphql:
    name: ${self:provider.stage}-graphql
    description: GraphQL Handler (GET/POST /graphql)
    handler: graphql/index.handler
    warmup: production
    events:
      - http:
          path: graphql
          method: post
      - http:
          path: graphql
          method: get
  graphiql:
    name: ${self:provider.stage}-graphiql
    description: GraphiQL Handler (GET /graphqli)
    handler: graphql/index.graphiqlHandler
    events:
      - http:
          path: graphiql
          method: get

@cesargdm
Copy link

cesargdm commented Jul 4, 2018

I was using Node 8.11 in Lambda with this configutation, and worked perfectly

module.exports.graphiQL = server.graphiqlLambda({		
  endpointURL: '/graphql',		
})
functions
  graphiql:		
    handler: handler.graphiQL		
      events:		
        http:
            path: graphiql
            method: get

@evans
Copy link
Contributor

evans commented Jul 26, 2018

I'm going to close this, since it seems we've figured out the issue and #1125 is out!

@evans evans closed this as completed Jul 26, 2018
@khaledosman
Copy link

Is it possible to use graphiql with apollo-server2 or only playground?

I get TypeError: server.graphiqlLambda is not a function

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants