question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document options for GraphQLServerLambda, specifically cors

See original GitHub issue

There have been quite a few questions about configuring cors with graphql-yoga, especially when using GraphQLServerLambda (example with more context).

Does the following work?

const options = {
  cors: {
    'origin': ['http://localhost:8080/'],
    'methods': ['GET', 'HEAD', 'POST'],
    'preflightContinue': false,
    'optionsSuccessStatus': 200
  }
}

lambda = new GraphQLServerLambda({
  options,
  schema,
})

exports.server = lambda.graphqlHandler

If so, this should be properly documented. If not, this should be added as a feature.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:8

github_iconTop GitHub Comments

2reactions
stale[bot]commented, Jan 29, 2019

Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.

1reaction
stale[bot]commented, May 31, 2019

Hey 👋, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of graphql-yoga we’ll close it. Feel free to reopen it at any time if you believe we should futher discuss its content. 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring CORS - Apollo GraphQL Docs
CORS uses specific HTTP response headers as part of its protocol, including Access-Control-Allow-Origin . ... Configuring CORS options for Apollo Server.
Read more >
Document options for GraphQLServerLambda, specifically cors
There have been quite a few questions about configuring cors with graphql-yoga, especially when using GraphQLServerLambda (example with more context).
Read more >
How to enable cors for apollo-server-lambda - Stack Overflow
Following the CORS setup instructions here I can successfully use apollo-angular to return results for a simple query.
Read more >
@pythonit/apollo-server-lambda-with-cors-regex - npm
This will look for a file called graphql.js with the export graphqlHandler . It creates one API endpoints: /graphql (GET and POST). In...
Read more >
CORS – GraphQL Yoga
For example, if your web client is deployed to example.com but your Yoga server is api.example.com. For security reasons your browser will not ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found