Skip to content

x-request-id isn't being propagated from the request to the response #2624

@miparnisari

Description

@miparnisari

Unless I'm misunderstanding this feature, If i do:

 go run ./cmd/spicedb/main.go serve --http-enabled true --grpc-preshared-key "somerandomkeyhere"

and then

curl --location 'http://localhost:8443/v1/schema/write' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'x-request-id: mysuperduperrequestid' \
    --header 'Authorization: Bearer somerandomkeyhere' \
    --data '{
        "schema": "definition user {} \n definition folder { \n relation parent: folder\n relation viewer: user \n permission view = viewer + parent->view \n } \n definition document {\n relation folder: folder \n relation viewer: user \n permission view = viewer + folder->view \n }"
    }' -D -

shows

HTTP/1.1 200 OK
Content-Type: application/json
Grpc-Metadata-Content-Type: application/grpc
Date: Fri, 17 Oct 2025 23:52:14 GMT
Content-Length: 70

{"writtenAt":{"token":"Gh8KEzE3NjA3NDUxMzQ1MTg1MzYwMDASCDU0NjQ2MDM5"}}%

those headers are lacking the 'x-request-id: mysuperduperrequestid' that I sent.

To debug further, I added a log line after this one

md, ok := metadata.FromIncomingContext(ctx)
and it shows:

5:03PM WRN requestid: extracted metadata: map[:authority:[localhost:50051] authorization:[Bearer somerandomkeyhere] content-type:[application/grpc] grpc-accept-encoding:[s2,gzip] grpcgateway-accept:[application/json] grpcgateway-authorization:[Bearer somerandomkeyhere] grpcgateway-content-type:[application/json] grpcgateway-user-agent:[curl/8.7.1] user-agent:[grpc-go/1.75.1] x-forwarded-for:[::1] x-forwarded-host:[localhost:8443]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/api httpAffects the HTTP Gateway APIarea/observabilityAffects telemetry datakind/bugSomething is broken or regressed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions