-
Notifications
You must be signed in to change notification settings - Fork 574
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
cf modules e2e test #1814
cf modules e2e test #1814
Conversation
|
export default { | ||
fetch(request: Request, env: { [key: string]: string }) { | ||
const yoga = createYoga({ | ||
graphqlEndpoint: env.GRAPHQL_ROUTE || '/graphql', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do landingPage: false
and then GRAPHQL_ROUTE
is injected to tell the Yoga server to expect incoming connections on e2e.graphql-yoga.com/WORKER_ID
This way we can have a public endpoint easily, without the need to capture /WORKER_ID/*
.
It's a workaround, but it works for now...
export default { fetch } | ||
export default { | ||
fetch(request: Request, env: { [key: string]: string }) { | ||
const yoga = createYoga({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove the parameter and modify the bundled code inside the deployment script;
https://github.com/dotansimha/graphql-yoga/pull/1812/files
Or do you think it is too tricky?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it's too tricky... see my other comments on why we need this setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is also our example for CF Modules and useLandingPage
and having yoga
in the fetch function etc are too much for a basic example. We can have another project for e2e tests but we will lose the ability of testing the actual example in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, so let's move on with this PR as-is. Then, we'll open an issue to improve the setup. We'll need to experiment with using the router config that includes *
, then we can use /WORKER_ID/graphql
and keep the landing page enabled.
export default { | ||
fetch(request: Request, env: { [key: string]: string }) { | ||
const yoga = createYoga({ | ||
graphqlEndpoint: env.GRAPHQL_ROUTE || '/graphql', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, CF module Worker doesn't use the globals for env vars, only through the env
provided as part of fetch
, so we need a thin wrapper in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding those extra options to our example, we can make it work by modifying the bundle like here;
#1812
What do you think @dotansimha @saihaj ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can do that too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the tricky part of it is just that is mutates the code example
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-yoga/apollo-link |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/urql-exchange |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/common |
3.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/redis-event-target |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/typed-event-target |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/graphiql |
3.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
graphql-yoga |
3.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/node |
3.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-apollo-inline-trace |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-apq |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-persisted-operations |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-response-cache |
1.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/render-graphiql |
3.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/subscription |
3.0.0-alpha-20220929105207-edf92781 |
npm ↗︎ unpkg ↗︎ |
✅ Benchmark Results
|
🚀 Website PreviewThe latest changes to the website are available as preview in: https://87dc35f3.graphql-yoga.pages.dev |
No description provided.