hasura / hasura/graphql-engine

Null session variables for column presets

Open
#8,173 2 comments 4 reactions 0 assignees View on GitHub
k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

Column presets are extremely useful for adding info from auth data. However, there is sometimes data that isn't available for every user, so it would be useful to leave that column null.

### Describe the solution you'd like

In my case, I'm filling in a nullable column of type UUID. I'd like to either not pass the header at all and leave the column `NULL` (currently this returns an error as the header must exist even if it's being used for a null type), or pass some sentinel string that represents null (currently, Postgres casts from strings don't ever return `NULL`, only errors).

### Describe alternatives you've considered

https://hasura.io/docs/latest/graphql/core/auth/authorization/roles-variables.html#format-of-session-variables mentions

> In future, we’ll add support for passing session variables as JSON values where possible (i.e, auth webhook and JWT but not in headers).

This may be fixed along with that if `null` is an allowed value.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how column presets and session variables are processed, then inspect the PostgreSQL UUID handling described in the issue. Determine how missing or JSON null session values are represented and tested; done means a nullable preset column can remain NULL without requiring a header or relying on an invalid sentinel string.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgres, typescript
Domain
api, authorization, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.