You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When modifying a draft via GraphQL API, there can be no current user assigned, i.e. Craft::$app->getUser()->getId() returns null. In this case there is no way to assign any valid creatorId so requiring an integer for $creatorId argument does not look completely correct.
In particular this causes failures when modifying Neo block fields with GraphQL.
Probably the issue is on the plugin side, but since there seems to be no way for it to get ID of the current user it seems to me that API from Craft side is inconsistent.
Steps to reproduce
Create an entry with a Neo field
Create a draft for an entry
Try to modify the value of Neo field for the draft using GraphQL API.
Expected behavior
Changes are applied to the draft.
Actual behavior
An exception is thrown:
[TypeError] craft\services\Drafts::createDraft(): Argument #2 ($creatorId) must be of type int, null given, called in /app/vendor/spicyweb/craft-neo/src/Field.php on line 1197
The exception originates from this line where plugin tries to create draft for a block providing ID of the current user which is null.
Craft CMS version
4.2.3
PHP version
8.0
Operating system and version
Debian GNU/Linux 11
Database type and version
PostgreSQL 13.6
Image driver and version
No response
Installed plugins and versions
spicyweb/craft-neo : 3.3.7
The text was updated successfully, but these errors were encountered:
@brandonkelly thank you, we've tested it in dev and it works properly now. Could you please share any timeframe when we can expect Craft 4.3 to be released?
What happened?
Description
When modifying a draft via GraphQL API, there can be no current user assigned, i.e.
Craft::$app->getUser()->getId()
returnsnull
. In this case there is no way to assign any validcreatorId
so requiring an integer for$creatorId
argument does not look completely correct.In particular this causes failures when modifying Neo block fields with GraphQL.
Probably the issue is on the plugin side, but since there seems to be no way for it to get ID of the current user it seems to me that API from Craft side is inconsistent.
Steps to reproduce
Expected behavior
Changes are applied to the draft.
Actual behavior
An exception is thrown:
The exception originates from this line where plugin tries to create draft for a block providing ID of the current user which is
null
.Craft CMS version
4.2.3
PHP version
8.0
Operating system and version
Debian GNU/Linux 11
Database type and version
PostgreSQL 13.6
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: