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

fix: include the original context error in extensions in dev mode for error thrown during context creation #1471

Merged
merged 3 commits into from
Aug 12, 2022

Conversation

n1ru4l
Copy link
Owner

@n1ru4l n1ru4l commented Aug 12, 2022

include the original context error in extensions in dev mode for error thrown during context creation

Previously, a non GraphQLError/EnvelopError was simply swallowed. By wrapping it inside a GraphQLError (,similar to what graphql-js is doing with Error thrown within resolvers,) we ensure that the error is properly handled within the format function.

See dotansimha/graphql-yoga#1584 (comment) for more context


Discovered while investigating dotansimha/graphql-yoga#1584

@changeset-bot
Copy link

changeset-bot bot commented Aug 12, 2022

🦋 Changeset detected

Latest commit: 45dd35a

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

This PR includes changesets to release 1 package
Name Type
@envelop/core 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

@vercel
Copy link

vercel bot commented Aug 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
envelop ✅ Ready (Inspect) Visit Preview Aug 12, 2022 at 7:41AM (UTC)

@theguild-bot
Copy link
Collaborator

theguild-bot commented Aug 12, 2022

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

@envelop/core@2.4.3-alpha-639d198b.0
@envelop/apollo-datasources@1.1.3-alpha-639d198b.0
@envelop/apollo-federation@2.4.3-alpha-639d198b.0
@envelop/apollo-server-errors@3.4.3-alpha-639d198b.0
@envelop/apollo-tracing@3.4.3-alpha-639d198b.0
@envelop/auth0@3.4.3-alpha-639d198b.0
@envelop/dataloader@3.4.3-alpha-639d198b.0
@envelop/depth-limit@1.6.3-alpha-639d198b.0
@envelop/disable-introspection@3.4.3-alpha-639d198b.0
@envelop/execute-subscription-event@2.4.3-alpha-639d198b.0
@envelop/extended-validation@1.7.3-alpha-639d198b.0
@envelop/filter-operation-type@3.4.3-alpha-639d198b.0
@envelop/fragment-arguments@3.4.3-alpha-639d198b.0
@envelop/generic-auth@4.3.3-alpha-639d198b.0
@envelop/graphql-jit@4.4.3-alpha-639d198b.0
@envelop/graphql-middleware@3.4.3-alpha-639d198b.0
@envelop/graphql-modules@3.4.3-alpha-639d198b.0
@envelop/live-query@4.0.2-alpha-639d198b.0
@envelop/newrelic@4.1.3-alpha-639d198b.0
@envelop/opentelemetry@3.4.3-alpha-639d198b.0
@envelop/operation-field-permissions@3.4.3-alpha-639d198b.0
@envelop/parser-cache@4.5.3-alpha-639d198b.0
@envelop/persisted-operations@4.4.3-alpha-639d198b.0
@envelop/preload-assets@3.4.3-alpha-639d198b.0
@envelop/prometheus@6.4.3-alpha-639d198b.0
@envelop/rate-limiter@3.4.3-alpha-639d198b.0
@envelop/resource-limitations@2.4.3-alpha-639d198b.0
@envelop/response-cache@3.0.3-alpha-639d198b.0
@envelop/response-cache-redis@1.0.3-alpha-639d198b.0
@envelop/sentry@3.6.4-alpha-639d198b.0
@envelop/statsd@2.4.3-alpha-639d198b.0
@envelop/validation-cache@4.5.3-alpha-639d198b.0
@envelop/testing@4.4.3-alpha-639d198b.0

@theguild-bot
Copy link
Collaborator

theguild-bot commented Aug 12, 2022

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.............................................: 100.00% ✓ 604482      ✗ 0     
     data_received......................................: 2.3 GB  16 MB/s
     data_sent..........................................: 132 MB  877 kB/s
     envelop_init.......................................: avg=524ns    min=99ns    med=299ns   max=205.6µs p(90)=700ns   p(95)=1.99µs 
     ✓ { mode:envelop-cache-jit }.......................: avg=324ns    min=99ns    med=299ns   max=115.6µs p(90)=499ns   p(95)=600ns  
     ✓ { mode:envelop-just-cache }......................: avg=264ns    min=99ns    med=200ns   max=164.8µs p(90)=399ns   p(95)=500ns  
     ✓ { mode:graphql-js }..............................: avg=679ns    min=200ns   med=499ns   max=94.6µs  p(90)=1.69µs  p(95)=2.39µs 
     ✓ { mode:prom-tracing }............................: avg=2.56µs   min=1.5µs   med=1.99µs  max=205.6µs p(90)=2.5µs   p(95)=7.89µs 
     envelop_total......................................: avg=203.45µs min=0s      med=19.69µs max=16.47ms p(90)=458.7µs p(95)=1.49ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=19.9µs   min=15.2µs  med=18.5µs  max=8.33ms  p(90)=24.39µs p(95)=27.49µs
     ✓ { mode:envelop-just-cache }......................: avg=188.6µs  min=167.7µs med=182.8µs max=13.47ms p(90)=195µs   p(95)=204.7µs
     ✓ { mode:graphql-js }..............................: avg=497.5µs  min=414.4µs med=453.2µs max=14.96ms p(90)=491.4µs p(95)=533.3µs
     ✓ { mode:prom-tracing }............................: avg=1.65ms   min=1.45ms  med=1.52ms  max=16.47ms p(90)=1.64ms  p(95)=2.7ms  
     event_loop_lag.....................................: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:prom-tracing }............................: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_context....................................: avg=3.63µs   min=1.59µs  med=2.69µs  max=4.38ms  p(90)=6.2µs   p(95)=6.99µs 
     ✓ { mode:envelop-cache-jit }.......................: avg=2.51µs   min=1.59µs  med=2.29µs  max=4.38ms  p(90)=3.09µs  p(95)=3.9µs  
     ✓ { mode:envelop-just-cache }......................: avg=2.96µs   min=1.99µs  med=2.69µs  max=3.68ms  p(90)=3.3µs   p(95)=3.8µs  
     ✓ { mode:graphql-js }..............................: avg=6.12µs   min=4.19µs  med=5.29µs  max=1.36ms  p(90)=8.6µs   p(95)=9.49µs 
     ✓ { mode:prom-tracing }............................: avg=7.38µs   min=5.99µs  med=6.9µs   max=497.6µs p(90)=7.7µs   p(95)=9.4µs  
     graphql_execute....................................: avg=207.44µs min=8.2µs   med=166.7µs max=16.28ms p(90)=192.2µs p(95)=1.44ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=10.33µs  min=8.2µs   med=9.6µs   max=6.87ms  p(90)=11.89µs p(95)=13.2µs 
     ✓ { mode:envelop-just-cache }......................: avg=178.34µs min=159.5µs med=173.2µs max=13.45ms p(90)=182.7µs p(95)=192.4µs
     ✓ { mode:graphql-js }..............................: avg=194.41µs min=164.8µs med=176µs   max=14.69ms p(90)=188.4µs p(95)=198.7µs
     ✓ { mode:prom-tracing }............................: avg=1.59ms   min=1.38ms  med=1.45ms  max=16.28ms p(90)=1.55ms  p(95)=2.63ms 
     graphql_parse......................................: avg=9.56µs   min=3.09µs  med=4.7µs   max=6.2ms   p(90)=15.39µs p(95)=48.6µs 
     ✓ { mode:envelop-cache-jit }.......................: avg=4.9µs    min=3.09µs  med=4.59µs  max=3.5ms   p(90)=6.3µs   p(95)=7.19µs 
     ✓ { mode:envelop-just-cache }......................: avg=5µs      min=3.4µs   med=4.5µs   max=1.52ms  p(90)=5.6µs   p(95)=6.5µs  
     ✓ { mode:graphql-js }..............................: avg=12.59µs  min=8.2µs   med=10.3µs  max=6.2ms   p(90)=16.3µs  p(95)=18.19µs
     ✓ { mode:prom-tracing }............................: avg=51.67µs  min=43.79µs med=49.8µs  max=1.01ms  p(90)=56.9µs  p(95)=62.39µs
     graphql_validate...................................: avg=51.42µs  min=1.29µs  med=1.89µs  max=9.7ms   p(90)=259µs   p(95)=265.7µs
     ✓ { mode:envelop-cache-jit }.......................: avg=1.82µs   min=1.29µs  med=1.7µs   max=1.24ms  p(90)=2.1µs   p(95)=2.29µs 
     ✓ { mode:envelop-just-cache }......................: avg=2.01µs   min=1.39µs  med=1.8µs   max=1.64ms  p(90)=2.1µs   p(95)=2.19µs 
     ✓ { mode:graphql-js }..............................: avg=283.69µs min=225.9µs med=260.1µs max=9.7ms   p(90)=281.2µs p(95)=299.9µs
     ✓ { mode:prom-tracing }............................: avg=6.34µs   min=4.79µs  med=5.5µs   max=3.09ms  p(90)=6.7µs   p(95)=8.1µs  
     http_req_blocked...................................: avg=3.05µs   min=700ns   med=1.3µs   max=22.79ms p(90)=2µs     p(95)=2.29µs 
     http_req_connecting................................: avg=584ns    min=0s      med=0s      max=22.76ms p(90)=0s      p(95)=0s     
     http_req_duration..................................: avg=4.58ms   min=192.5µs med=2.94ms  max=80.34ms p(90)=9.87ms  p(95)=16.04ms
       { expected_response:true }.......................: avg=4.58ms   min=192.5µs med=2.94ms  max=80.34ms p(90)=9.87ms  p(95)=16.04ms
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=3.6ms    min=393.8µs med=2.86ms  max=53.7ms  p(90)=5.9ms   p(95)=6.82ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=2.61ms   min=192.5µs med=1.99ms  max=32.16ms p(90)=4.95ms  p(95)=9.14ms 
     ✓ { mode:envelop-just-cache }......................: avg=3.79ms   min=409.6µs med=2.94ms  max=63.32ms p(90)=6.13ms  p(95)=7.55ms 
     ✓ { mode:graphql-js }..............................: avg=7.23ms   min=774.6µs med=5.68ms  max=55.1ms  p(90)=11.68ms p(95)=13.03ms
     ✓ { mode:prom-tracing }............................: avg=18.54ms  min=4.73ms  med=16.53ms max=80.34ms p(90)=32.1ms  p(95)=33.43ms
     http_req_failed....................................: 0.00%   ✓ 0           ✗ 302241
     http_req_receiving.................................: avg=48.34µs  min=11.2µs  med=22.5µs  max=24.97ms p(90)=31.4µs  p(95)=38.9µs 
     http_req_sending...................................: avg=36.06µs  min=4.8µs   med=7.9µs   max=37ms    p(90)=14.9µs  p(95)=25µs   
     http_req_tls_handshaking...........................: avg=0s       min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...................................: avg=4.49ms   min=163.4µs med=2.9ms   max=80.16ms p(90)=9.46ms  p(95)=15.9ms 
     http_reqs..........................................: 302241  2014.820952/s
     iteration_duration.................................: avg=4.95ms   min=421.9µs med=3.23ms  max=80.68ms p(90)=10.66ms p(95)=16.45ms
     iterations.........................................: 302241  2014.820952/s
     vus................................................: 2       min=2         max=15  
     vus_max............................................: 20      min=20        max=20  

@n1ru4l n1ru4l merged commit 5a5f5c0 into main Aug 12, 2022
@n1ru4l n1ru4l deleted the fix-dev-mode-error-extensions branch August 12, 2022 07:55
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.

None yet

3 participants