facebook / facebook/relay

`fieldPath` is always empty string on `relay_field_payload.error`

Open
#4,970 1 comment 0 reactions 0 assignees View on GitHub
shared with relay team
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I was playing around with the `relayFieldLogger` to customize the errors being thrown for certain events when I noticed that the `fieldPath` on the `relay_field_payload.error` event seems to always be an empty string.

This is the query I executed:
```typescript
const data = useLazyLoadQuery(
graphql`
query AppQuery @throwOnFieldError {
company {
name
}
}
`,
{}
);
```

This is the response returned by the network:
```json
{
"errors": [
{
"message": "Something happened",
"path": ["company", "name"],
"extensions": { "code": "E1" }
}
],
"data": { "company": { "name": null } }
}
```

This is the event passed to the `relayFieldLogger`:
```json
{
"kind": "relay_field_payload.error",
"owner": "AppQuery",
"fieldPath": "",
"error": {
"message": "Something happened",
"extensions": {
"code": "E1"
}
},
"shouldThrow": true,
"handled": false
}
```

My expectation would've been for the `fieldPath` to be `'company.name'`. Is the current behavior expected or a bug?

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.