graphql-hive / graphql-hive/envelop
Can't respond to errors triggered in plugins
- Dominant language
- No language data
- Stars
- 827
- Forks
- 132
- PR merge metrics
- No merged PRs in 30d
Description
### Issue workflow progress
_Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_
- [ ] 1. The issue provides a [minimal reproduction](https://en.wikipedia.org/wiki/Minimal_reproducible_example) available on [Stackblitz](https://stackblitz.com/fork/node).
- _Please install the latest `@envelop/*` packages that you are using._
- _Please make sure the reproduction is as small as possible._
- [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
---
**Describe the bug**
Can't respond to errors triggered in plugins. Errors do bubble up into the server response `errors` key however there is no way to respond to them (reshape, log etc..)
**To Reproduce**
Consider this:
Error thrown in `useExtendContext` can't be handled anywhere.
```export const getEnveloped = envelop({
plugins: [
useExtendContext(() => {
throw new Error('plugin error')
return {}
}),
useErrorHandler((_errors, _args) => {
// never triggered
}),
useApolloServerErrors({
debug: true,
formatter: (err: GraphQLError) => {
// never triggered
return err
}
}),
]
})
```
**Expected behavior**
Respond to thrown errors before they are sent.
**Environment:**
- OS: Linux 64bit
- `@envelop/...`:
- "@envelop/apollo-server-errors": "^2.0.0",
"@envelop/apollo-tracing": "^2.0.0",
"@envelop/core": "^1.7.1",
"@envelop/depth-limit": "^1.2.1",
"@envelop/disable-introspection": "^2.0.0",
"@envelop/graphql-middleware": "^2.0.0",
"@envelop/parser-cache": "^3.0.0",
"@envelop/rate-limiter": "^2.0.0",
"@envelop/resource-limitations": "^1.0.1",
"@envelop/validation-cache": "^3.0.0",
- NodeJS: 16.3.0
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.