Node's author field null on Query Batching

Created on 27 March 2024, 3 months ago
Updated 10 April 2024, 3 months ago

Problem/Motivation

I'm using graphql-request for fetching data in a Next.js application. I need to use `batchRequests` for Global site data (header & footer) and node content. The problem is with the author field of the node, it's returning null

Steps to reproduce

- In the Next.js app, install graphql-request
- Set an Authorization-Bearer code to execute authenticated requests
- Configure a content type in Drupal to expose Node author information
- Execute a batchRequest from Next.js

πŸ› Bug report
Status

Closed: cannot reproduce

Version

2.1

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica mcortes19

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mcortes19
  • πŸ‡¦πŸ‡ΊAustralia AlMunnings Melbourne

    Can you supply a way to re-create the issue, outside of you app?

    EG with Postman or CURL?

  • Status changed to Postponed: needs info 3 months ago
  • πŸ‡¦πŸ‡ΊAustralia AlMunnings Melbourne
  • πŸ‡¨πŸ‡·Costa Rica mcortes19

    @almunnings Since we are using graphql-request for batching request, is not easy to replicate this issue outside the app.

    After a thoroughly debugging, we noticed at some point the`EntityOwner` FieldType wasn't returning the `entity_owner` data-producer when we requested data using batch-request. So we ended up by removing that approach and just request all information we need in a single GraphQL query.

  • πŸ‡¦πŸ‡ΊAustralia AlMunnings Melbourne

    Hmm,
    I don't know off the top of my head how that could happen.

    Without a network request or a graphql query to go off of, I can't do much here. :(

  • Status changed to Closed: cannot reproduce 3 months ago
  • πŸ‡¦πŸ‡ΊAustralia AlMunnings Melbourne

    I'll leave this here,
    It's the best I can do without any knowledge of your app.

    I've created a little sample repo using the library you mentioned.
    And in that setup some jest tests to a local version I have running here.

     PASS  ./batch.test.js
      βœ“ get the schema info (37 ms)
      βœ“ authenticate and get user (31 ms)
      βœ“ get node author (31 ms)
      βœ“ batched requests (44 ms)
    
    Test Suites: 1 passed, 1 total
    Tests:       4 passed, 4 total
    Snapshots:   0 total
    Time:        0.74 s, estimated 1 s
    

    https://github.com/almunnings/3436315-issue-testing

    Feel free to re-open this support request if you get any further in your testing, for now it's working as expected form my end. It could be localised to your drupal in some other way we don't know about yet. Maybe user permissions?

Production build 0.69.0 2024