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

Please check if the endpoint 'undefined' is a valid GraphQL Endpoint. #287

Closed
1 task done
DaleLJefferson opened this issue Dec 1, 2017 · 3 comments
Closed
1 task done

Comments

@DaleLJefferson
Copy link

DaleLJefferson commented Dec 1, 2017

This issue pertains to:

  • graphql-playground-middleware-lambda

What OS and OS version are you experiencing the issue(s) on?

Mac OS, Chrome 63, AWS Lambda Node 6.10

What version of graphql-playground(-electron/-middleware) are you experience the issue(s) on?

1.3.1

What is the expected behavior?

Successfully load the playground

What is the actual behavior?

I see an error message

Schema could not be fetched. Please check if the endpoint 'undefined' is a valid GraphQL Endpoint.

Strangly queries work so it's just the schema fetching that is broken.

POST http://localhost:3000/undefined 404 (Not Found)

DOMException: Failed to construct 'WebSocket': The URL 'graphql' is invalid.
    at e.connect (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:1381884)
    at new e (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:1375721)
    at n.o.setWS (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:971800)
    at n.resetSubscription (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:986023)
    at https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:985841
    at Array.forEach (<anonymous>)
    at n.resetSubscriptions (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:985812)
    at n.<anonymous> (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:981685)
    at commitCallbacks (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:833667)
    at commitLifeCycles (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:786909)
    at n (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:790837)
    at u (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:792504)
    at l (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:792947)
    at h (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:794970)
    at f (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:794479)
    at Object.enqueueSetState (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:775731)
    at t.i.setState (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:755421)
    at t.<anonymous> (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:969046)
    at r (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:961593)
    at Object.next (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:960928)
    at a (https://cdn.jsdelivr.net/npm/graphql-playground@1.3.1/build/static/js/middleware.js:1:960694)
    at <anonymous>
o.setWS @ Playground.tsx:268
n.resetSubscription @ Playground.tsx:676
(anonymous) @ Playground.tsx:667
n.resetSubscriptions @ Playground.tsx:667
(anonymous) @ Playground.tsx:226
commitCallbacks @ react-dom.production.min.js:109
commitLifeCycles @ react-dom.production.min.js:169
n @ react-dom.production.min.js:180
u @ react-dom.production.min.js:183
l @ react-dom.production.min.js:184
h @ react-dom.production.min.js:188
f @ react-dom.production.min.js:187
enqueueSetState @ react-dom.production.min.js:140
i.setState @ react.production.min.js:12
(anonymous) @ MiddlewareApp.tsx:458
r @ middleware.js:66538
(anonymous) @ middleware.js:66504
a @ middleware.js:66471
Promise resolved (async)
c @ middleware.js:66486
(anonymous) @ middleware.js:66488
c @ middleware.js:66468
t.updateSubscriptionsUrl @ middleware.js:66854
t.componentDidMount @ MiddlewareApp.tsx:240
commitLifeCycles @ react-dom.production.min.js:169
n @ react-dom.production.min.js:180
u @ react-dom.production.min.js:183
l @ react-dom.production.min.js:184
h @ react-dom.production.min.js:188
f @ react-dom.production.min.js:187
updateContainer @ react-dom.production.min.js:248
(anonymous) @ react-dom.production.min.js:254
unbatchedUpdates @ react-dom.production.min.js:190
dt @ react-dom.production.min.js:254
render @ react-dom.production.min.js:255
init @ middlewareIndex.tsx:18
(anonymous) @ playground:48

What steps may we take to reproduce the behavior?

Upgrade to graphql-playground-middleware-lambda 1.3.1

import lambdaPlayground from 'graphql-playground-middleware-lambda'

export const handler = lambdaPlayground({endpoint: 'graphql'})

screen shot 2017-12-01 at 13 55 17

@timsuchanek
Copy link
Member

@dalejefferson I think the problem is, that you're providing graphql as the endpoint. But it should rather be /graphqlor /dev/graphql if your stage in serverless/lambda is dev.
I created an example here:
https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-lambda/examples/basic

It's deployed here: https://1rp2h4rth8.execute-api.us-east-1.amazonaws.com/dev/playground

Does that solve your issue?

The issue for the graphql-playground here is definitely to provide better error handling.
I create a separate issue for that.

@JstnEdr
Copy link

JstnEdr commented Dec 4, 2017

I'm experiencing the same problem. While I haven't yet found a fix, I have found a workaround that hopefully helps diagnose the root problem. For me, using the default /graphql path results in this error.

Schema could not be fetched. Please check if the endpoint 'undefined' is a valid GraphQL Endpoint.

But if I change the http path to graphqltest, I then get a working Playground. I know this isn't a full fix, but it may be a clue as to where the problem is stemming from.

@DaleLJefferson
Copy link
Author

I've just upgraded to "graphql-playground-middleware-lambda": "1.3.6" and everything seems to be working now. Thanks for the prompt response. 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants