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

Bump Fetch and Server Adapter packages for Bun Compatibility #1347

Merged
merged 9 commits into from
Sep 7, 2022
Merged

Conversation

n1ru4l
Copy link
Collaborator

@n1ru4l n1ru4l commented Jul 6, 2022

For things to start I had to edit node_modules/tiny-lru/package.json and add an exports map.

  "exports": {
    ".": {
      "default": "./lib/tiny-lru.esm.mjs",
      "require": "./lib/tiny-lru-cjs.js"
    }
  }

Also run mv node_modules/tiny-lru/lib/tiny-lru.esm.js node_modules/tiny-lru/lib/tiny-lru.esm.mjs


Things start (bun examples/bun/index.ts), but the server crashes once you visit localhost:3000.

laurinquast@Laurins-MBP graphql-yoga % bun examples/bun/index.ts                                   

BusError at 5100912640


–––– bun meta ––––
Bun v0.1.1 macOS Silicon 21.3.0
AutoCommand: 
Elapsed: 19284ms | User: 146ms | Sys: 222ms
RSS: 1.14GB | Peak: 1.14GB | Commit: 67.11MB | Faults: 0
–––– bun meta ––––

Ask for #help in https://bun.sh/discord or go to https://bun.sh/issues

@changeset-bot
Copy link

changeset-bot bot commented Jul 6, 2022

🦋 Changeset detected

Latest commit: 53654ce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
graphql-yoga Patch
@graphql-yoga/common Patch
@graphql-yoga/node Patch
apollo-federation-gateway-with-yoga Patch
apollo-subgraph-with-yoga Patch
graphql-lambda Patch
cloudflare-advanced Patch
cloudflare Patch
hackernews Patch
hello-world-benchmark Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2022

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.........................: 100.00% ✓ 106808      ✗ 0    
     data_received..................: 16 MB   530 kB/s
     data_sent......................: 6.1 MB  205 kB/s
     http_req_blocked...............: avg=2.02µs   min=1.2µs   med=1.7µs   max=2.99ms  p(90)=2.29µs   p(95)=2.6µs   
     http_req_connecting............: avg=52ns     min=0s      med=0s      max=2.79ms  p(90)=0s       p(95)=0s      
   ✓ http_req_duration..............: avg=447.08µs min=298µs   med=396.9µs max=26.17ms p(90)=493.8µs  p(95)=582.44µs
       { expected_response:true }...: avg=447.08µs min=298µs   med=396.9µs max=26.17ms p(90)=493.8µs  p(95)=582.44µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 53404
     http_req_receiving.............: avg=28.79µs  min=17.7µs  med=24.6µs  max=8.71ms  p(90)=34.79µs  p(95)=40.09µs 
     http_req_sending...............: avg=11.22µs  min=6.4µs   med=8.2µs   max=2.16ms  p(90)=18.2µs   p(95)=19.59µs 
     http_req_tls_handshaking.......: avg=0s       min=0s      med=0s      max=0s      p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=407.06µs min=268.4µs med=360.3µs max=26.01ms p(90)=446.3µs  p(95)=527.4µs 
     http_reqs......................: 53404   1779.779381/s
     iteration_duration.............: avg=555.04µs min=377.2µs med=503.6µs max=29.42ms p(90)=612.87µs p(95)=710µs   
     iterations.....................: 53404   1779.779381/s
     vus............................: 1       min=1         max=1  
     vus_max........................: 1       min=1         max=1  

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2022

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-yoga/apollo-link 1.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/urql-exchange 1.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/common 3.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/graphiql 2.4.3-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
graphql-yoga 3.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/node 3.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-inline-trace 1.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apq 1.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-persisted-operations 1.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-response-cache 1.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎
@graphql-yoga/render-graphiql 3.0.0-alpha-20220907151509-ce171cc9 npm ↗︎ unpkg ↗︎

@n1ru4l
Copy link
Collaborator Author

n1ru4l commented Sep 7, 2022

laurinquast@Laurins-MacBook-Pro graphql-yoga % bun --version
0.1.10

@ardatan I am getting the following error on GraphIQL:

{
  "errors": [
    "{\n  \"errors\": [\n    {\n      \"message\": \"POST body sent invalid JSON.\"\n    }\n  ]\n}"
  ]
}

For curl I get the following:

laurinquast@Laurins-MacBook-Pro graphql-yoga % curl localhost:4000/graphql -X POST -H 'content-type: application/json' -d '{"query":"{ __typename }"}'
{"errors":[{"message":"POST body sent invalid JSON."}]}%

We should definitely have some integration tests before merging this.

@ardatan ardatan force-pushed the bun-compat branch 2 times, most recently from bbe1e7d to f6766c8 Compare September 7, 2022 14:44
@ardatan ardatan changed the title Bun compat Bump Fetch and Server Adapter packages for Bun Compatibility Sep 7, 2022
@ardatan ardatan merged commit e2267d3 into v3 Sep 7, 2022
@ardatan ardatan deleted the bun-compat branch September 7, 2022 15:20
@charlypoly
Copy link
Contributor

/theguild newsletter

This was referenced Sep 21, 2022
@saihaj saihaj mentioned this pull request Oct 17, 2022
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

Successfully merging this pull request may close these issues.

3 participants