Skip to content

Commit

Permalink
docs: limitation of no request/response body access from router_servi…
Browse files Browse the repository at this point in the history
…ce (apollographql#4071)

Until apollographql#3642 is resolved
and from [prior
discussion](https://apollograph.slack.com/archives/C02UX05LF4K/p1695326294453519),
document the limitation that a request or response body cannot be
accessed from `router_service` callbacks.

Deploy previews:
- Added [new Services
limitation](https://deploy-preview-4071--apollo-router-docs.netlify.app/customizations/rhai#services)
  • Loading branch information
shorgi authored Oct 23, 2023
2 parents 0e51563 + e0a7af8 commit 135e897
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/source/customizations/rhai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ The Apollo Router requires that its Rhai engine implements the [sync feature](ht

This is particularly risky when using closures within callbacks while referencing external data. Take particular care to avoid this kind of situation by making copies of data when required. The [examples/surrogate-cache-key directory](https://github.com/apollographql/router/tree/main/examples/surrogate-cache-key) contains an example of this, where "closing over" `response.headers` would cause a deadlock. To avoid this, a local copy of the required data is obtained and used in the closure.

### Services

Callbacks of `router_service` cannot access the body of a request or response. At the router service stage, a request or response body is an opaque sequence of bytes.

## Debugging

### Understanding errors
Expand Down

0 comments on commit 135e897

Please sign in to comment.