Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using jsonpi jsonapi/group_content/business-group_node-article to make a post
Header:
Authorization:Basic YWRtaW46U3BhcmsxMjMh
Content-Type:application/vnd.api+json
Accept:application/vnd.api+json
Result:
TypeError: Argument 1 passed to Drupal\group\Plugin\GroupContentEnablerBase::createAccess() must implement interface Drupal\group\Entity\GroupInterface, null given, called in /app/www/groupjson4/modules/contrib/group/src/Entity/Access/GroupContentAccessControlHandler.php on line 30 in Drupal\group\Plugin\GroupContentEnablerBase->createAccess() (line 321 of /app/www/groupjson4/modules/contrib/group/src/Plugin/GroupContentEnablerBase.php) #0 /app/www/groupjson4/modules/contrib/group/src/Entity/Access/GroupContentAccessControlHandler.php(30): Drupal\group\Plugin\GroupContentEnablerBase->createAccess(NULL, Object(Drupal\Core\Session\AccountProxy)) #1 /app/www/groupjson4/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(260): Drupal\group\Entity\Access\GroupContentAccessControlHandler->checkCreateAccess(Object(Drupal\Core\Session\AccountProxy), Array, 'business-group_...') #2 /app/www/groupjson4/core/lib/Drupal/Core/Entity/ContentEntityBase.php(627): Drupal\Core\Entity\EntityAccessControlHandler->createAccess('business-group_...', Object(Drupal\Core\Session\AccountProxy), Array, true) #3 /app/www/groupjson4/modules/contrib/jsonapi/src/Controller/EntityResource.php(194): Drupal\Core\Entity\ContentEntityBase->access('create', NULL, true) #4 [internal function]: Drupal\jsonapi\Controller\EntityResource->createIndividual(Object(Drupal\group\Entity\GroupContent), Object(Symfony\Component\HttpFoundation\Request)) #5 /app/www/groupjson4/modules/contrib/jsonapi/src/Controller/RequestHandler.php(89): call_user_func_array(Array, Array) #6 /app/www/groupjson4/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\jsonapi\Controller\RequestHandler->Drupal\jsonapi\Controller\{closure}() #7 /app/www/groupjson4/modules/contrib/jsonapi/src/Controller/RequestHandler.php(90): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #8 [internal function]: Drupal\jsonapi\Controller\RequestHandler->handle(Object(Drupal\Core\Routing\RouteMatch), Object(Symfony\Component\HttpFoundation\Request)) #9 /app/www/groupjson4/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #10 /app/www/groupjson4/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #11 /app/www/groupjson4/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #12 /app/www/groupjson4/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #13 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #14 /app/www/groupjson4/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #15 /app/www/groupjson4/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 /app/www/groupjson4/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /app/www/groupjson4/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /app/www/groupjson4/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /app/www/groupjson4/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /app/www/groupjson4/modules/contrib/jsonapi/src/StackMiddleware/FormatSetter.php(40): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /app/www/groupjson4/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /app/www/groupjson4/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /app/www/groupjson4/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /app/www/groupjson4/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /app/www/groupjson4/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #26 {main}.
Comments
Comment #2
lawxen CreditAttribution: lawxen at Sparkpad commentedComment #3
lawxen CreditAttribution: lawxen at Sparkpad commentedMany people get the same error like: https://www.drupal.org/project/group/issues/2872645#comment-12400012
Comment #4
Wim LeersComment #5
Wim LeersComment #6
Wim LeersApparently the same issue exists for REST, which is exactly what I would expect: just like JSON:API,
rest.module
cannot hardcode Group-specific requirements.Let's continue in #2872645: Creating `Group` content is impossible via REST, JSON:API and GraphQL due to `$context['group']` being required in checking `create` access.