Node's author field null on Query Batching

Created on 27 March 2024, 8 months ago
Updated 10 April 2024, 8 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 8 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 8 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.71.5 2024