Cms: Graphql mutation returning null when giving a siteID

Created on 29 Jan 2021  路  9Comments  路  Source: craftcms/cms

Description

When adding en entry through a mutation I get null as a return when I'm using a siteId in the query

Steps to reproduce

  1. Try a mutation with siteID 1 and it will return correct output
    Input:
mutation saveProduct{
    save_products_products_Entry(
      authorId: 1
      siteId: 1
      productName: "abc"
    ){
     id
     productName
    }
  }

Output:

{
  "data": {
    "save_products_products_Entry": {
      "id": "46853",
      "productName": "abc"
    }
  }
}
  1. Try with siteID 2:
    Input:
mutation saveProduct{
    save_products_products_Entry(
      authorId: 1
      siteId: 2
      productName: "abc"
    ){
     id
     productName
    }
  }

Output:

  {
  "data": {
    "save_products_products_Entry": null
  }
}

And expected output would also be

{
  "data": {
    "save_products_products_Entry": {
      "id": "46853",
      "productName": "abc"
    }
  }
}

Additional info

  • Craft version: Craft Pro 3.5.17.1
  • PHP version: 7.4.13
  • Database driver & version: PostgreSQL 13.1
  • Plugins & versions:
bug graphql

Most helpful comment

Thank you! Fixed for the next Craft 3.6 release!

All 9 comments

@edwwaarrdd is the entry saved in the second case? If not, perhaps the section is not enabled for the site in question?

If none of that provides any answers - is there anything in the error logs? If not, is it an option to update to Craft 3.6.2? One of the changes there is improved error logging for GraphQL operations, which should help track this down.

@andris-sevcenko
Yes the entry is saved and I can fetch it with a query request to the graphql endpoint.
I will try to update the instance locally to 3.6.2 today and see if I can find anything in the logs.

@edwwaarrdd looking forward to it!

@andris-sevcenko
I updated to 3.6.2 locally and tried the query again still null as a return when given a siteId other than 1.
I cleared all the log files and closed all tabs where the cms was active as to not add other stuff to the log.
And did a call from insomnia and the web.log file is 11461 lines long 馃槄.
What do you want me to look for? or can I email the file to you?

@edwwaarrdd can you send a DB dump and your composer.json/lock files over to [email protected], while referencing this issue? I'll see if I can reproduce this locally and see what's what!

@andris-sevcenko Sent the email with everything in it

Thank you! Fixed for the next Craft 3.6 release!

Craft 3.6.5 is out now with that fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattstein picture mattstein  路  3Comments

darylknight picture darylknight  路  3Comments

michaelhue picture michaelhue  路  3Comments

angrybrad picture angrybrad  路  3Comments

bitboxfw picture bitboxfw  路  3Comments