hasura / hasura/graphql-engine

With large mutations (on POST webhook auth), get "Invalid response from authorization hook"

Open
#8,264 2 comments 0 reactions 0 assignees View on GitHub
k/bug support/needs-more-info
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: `v2.0.10-cloud.1`
CLI Version (for CLI related issue): --

### Environment

Hasura Cloud, and also locally with Hasura Docker image on M1 Macbook Pro

### What is the expected behaviour?

Mutations with large amounts of data when using webhook auth in POST mode succeed without eliciting any errors (especially misleading ones)

### Keywords

large variables request mutation post webhook auth body error unexpected

### What is the current behaviour?

I make a mutation using Apollo Client that contains around 700 items each of which are somewhat large JSON objects (~20-30 KV pairs). My hasura server uses POST webhook auth, which forwards the body of the request to my auth webhook. I put logs in my auth webhook so I'm pretty certain it is properly calling my webhook and I am properly returning a response.

However, instead of the request succeeding, it gives me the following error:

```
ApolloError: Invalid response from authorization hook

...

graphQLErrors: [
{
extensions: { path: '$', code: 'unexpected' },
message: 'Invalid response from authorization hook'
}
],
```

But I'm pretty sure my auth webhook is really returning a valid value. Then, I split the mutation in half into two smaller ones that together do the same thing, and I didn't get this error anymore.

Seems to be some interaction with large mutations and the auth webhook check mysteriously failing.

### How to reproduce the issue?

1. Turn on auth webhook in POST mode
2. run a mutation with a very large variable payload
3. see the error

### Screenshots or Screencast

Not really visual

### Please provide any traces or logs that could help here.

left the relevant logs above

### Any possible solutions?

dont use big mutations? or split apart big ones into smaller mutations

### Can you identify the location in the source code where the problem exists?

no, haven't looked

### If the bug is confirmed, would you be willing to submit a PR?

possibly, but I have no idea how hasura GQL engine works internally and would probably take a while to get it done.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.