-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify server handling and improve CF Workers compatibility (#4440)
* Simplify server handling and improve CF Workers compatibility * Add more to the docs * chore(dependencies): updated changesets for modified dependencies Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0cd6b5c
commit b9bb800
Showing
39 changed files
with
745 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
"@graphql-mesh/cli": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Added dependency [`@graphql-mesh/[email protected]` ↗︎](https://www.npmjs.com/package/@graphql-mesh/http/v/0.0.0) (to `dependencies`) | ||
- Added dependency [`@whatwg-node/[email protected]` ↗︎](https://www.npmjs.com/package/@whatwg-node/server/v/0.1.2) (to `dependencies`) | ||
- Added dependency [`@whatwg-node/[email protected]` ↗︎](https://www.npmjs.com/package/@whatwg-node/fetch/v/0.3.2) (to `dependencies`) | ||
- Added dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-yoga/v/3.0.0-alpha-20220905163021-e923bb34) (to `dependencies`) | ||
- Added dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/itty-router/v/2.6.1) (to `dependencies`) | ||
- Added dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/itty-router-extras/v/0.4.2) (to `dependencies`) | ||
- Removed dependency [`@graphql-yoga/node@^2.4.0` ↗︎](https://www.npmjs.com/package/@graphql-yoga/node/v/null) (from `dependencies`) | ||
- Removed dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/cookie-parser/v/1.4.6) (from `dependencies`) | ||
- Removed dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/cors/v/2.8.5) (from `dependencies`) | ||
- Removed dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/express/v/4.18.1) (from `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/graphql": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`@graphql-tools/[email protected]` ↗︎](https://www.npmjs.com/package/@graphql-tools/url-loader/v/7.15.0) (from `7.14.2`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/grpc": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-compose/v/9.0.9) (from `9.0.8`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/json-schema": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-compose/v/9.0.9) (from `9.0.8`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/mongoose": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-compose/v/9.0.9) (from `9.0.8`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/mysql": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-compose/v/9.0.9) (from `9.0.8`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-mesh/odata": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-compose/v/9.0.9) (from `9.0.8`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@omnigraph/json-schema": patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Updated dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/graphql-compose/v/9.0.9) (from `9.0.8`, in `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'@graphql-mesh/cli': minor | ||
'@graphql-mesh/http': minor | ||
--- | ||
|
||
- Drop express and other Node specific server packages | ||
- Introduce a new platform agnostic HTTP handler package using itty-router and @whatwg-node/server | ||
- Introduce a new function in the artifacts that allows you to create a platform agnostic HTTP handler; | ||
|
||
For example in CF Workers | ||
```ts | ||
import { createBuiltMeshHTTPHandler } from '../.mesh'; | ||
|
||
self.addEventListener('fetch', createBuiltMeshHTTPHandler()); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-mesh/graphql': patch | ||
--- | ||
|
||
Bump url loader to fix `credentials` error in CF Workers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'@graphql-mesh/grpc': patch | ||
'@graphql-mesh/json-schema': patch | ||
'@graphql-mesh/mongoose': patch | ||
'@graphql-mesh/mysql': patch | ||
'@graphql-mesh/odata': patch | ||
'@omnigraph/json-schema': patch | ||
'@graphql-mesh/types': patch | ||
--- | ||
|
||
Bump graphql-compose to fix incompatibility issues with non Node.js environments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,3 @@ | ||
import { getBuiltMesh } from '../.mesh'; | ||
import { createServer } from '@graphql-yoga/common'; | ||
import { createBuiltMeshHTTPHandler } from '../.mesh'; | ||
|
||
async function handleRequest(request: Request, event: any) { | ||
try { | ||
const mesh = await getBuiltMesh(); | ||
const server = createServer({ | ||
plugins: mesh.plugins, | ||
maskedErrors: false, | ||
graphiql: { | ||
title: 'OpenBrewery Mesh', | ||
}, | ||
}); | ||
return server.handleRequest(request, event); | ||
} catch (e) { | ||
return new Response(e.stack, { | ||
status: 500, | ||
}); | ||
} | ||
} | ||
|
||
self.addEventListener('fetch', (event: any) => { | ||
event.respondWith(handleRequest(event.request, event)); | ||
}); | ||
self.addEventListener('fetch', createBuiltMeshHTTPHandler()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,3 @@ | ||
import { getBuiltMesh } from '../.mesh'; | ||
import { createServer } from '@graphql-yoga/common'; | ||
import { createBuiltMeshHTTPHandler } from '../.mesh'; | ||
|
||
async function handleRequest(request: Request, event: any) { | ||
try { | ||
const mesh = await getBuiltMesh(); | ||
const server = createServer({ | ||
plugins: mesh.plugins, | ||
maskedErrors: false, | ||
graphiql: { | ||
title: 'SpaceX Mesh', | ||
}, | ||
}); | ||
return server.handleRequest(request, event); | ||
} catch (e) { | ||
return new Response(e.stack, { | ||
status: 500, | ||
}); | ||
} | ||
} | ||
|
||
self.addEventListener('fetch', (event: any) => { | ||
event.respondWith(handleRequest(event.request, event)); | ||
}); | ||
self.addEventListener('fetch', createBuiltMeshHTTPHandler()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
b9bb800
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.
Successfully deployed to the following URLs:
graphql-mesh – ./
graphql-mesh-git-master-theguild.vercel.app
graphql-mesh.com
graphql-mesh-azure.vercel.app
graphql-mesh-theguild.vercel.app
www.graphql-mesh.com