- Issue created by @amangrover90
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This fails at ApiLayoutController::267 because $regionForComponentId is null and it's not able to get the region even though content region exists under which this component is placed.
That's
if ($regionForComponentId !== XbPageVariant::MAIN_CONTENT_REGION) { if (!$page_regions[$regionForComponentId]->access('edit')) { throw new AccessDeniedHttpException(sprintf('Access denied for region %s', $regionForComponentId)); }
So โฆ this would mean that
$page_regions[$regionForComponentId]
resolves toNULL
, meaning that$regionForComponentId
is NOT one of the existingPageRegion
config entities?! ๐ฑCan you please apply this patch to get a more precise error message?
$ git diff diff --git a/src/Controller/ApiLayoutController.php b/src/Controller/ApiLayoutController.php index f34ce46cc..570082478 100644 --- a/src/Controller/ApiLayoutController.php +++ b/src/Controller/ApiLayoutController.php @@ -264,6 +264,9 @@ final class ApiLayoutController { if (!empty($page_regions)) { $regionForComponentId = $this->getRegionForComponentInstance($data['layout'], $componentInstanceUuid); if ($regionForComponentId !== XbPageVariant::MAIN_CONTENT_REGION) { + if (!array_key_exists($regionForComponentId, $page_regions)) { + throw new \LogicException(sprintf("Component instance %s is in a region (%s) for which no PageRegion config entity exists. Existing PageRegions: %s.", $componentInstanceUuid, $regionForComponentId, implode(', ', array_keys($page_regions)))); + } if (!$page_regions[$regionForComponentId]->access('edit')) { throw new AccessDeniedHttpException(sprintf('Access denied for region %s', $regionForComponentId)); }
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Oh wait:
because $regionForComponentId is null
If true, this would most likely be a bug in
\Drupal\experience_builder\Controller\ApiLayoutController::getRegionForComponentInstance()
?What would be really helpful is you sharing the full request body that triggered that 500 response ๐ That would allow us to easily write a failing test case to
ApiLayoutControllerPatchTest
. - ๐บ๐ธUnited States mglaman WI, USA
I walked through the xdebug of this. The component was in the `content` region. I think the bug is in the `slots` code
// Maybe it's not a component, but a slot inside a component. foreach ($componentData['slots'] as $slotData) { foreach ($slotData['components'] as $slotComponentData) { if ($slotComponentData['uuid'] === $componentInstanceUuid) { return TRUE; } } }
It was nested 2 or 3 levels deep.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Bumping priority and tagging , because AFAICT ๐ Created XB Pattern didnโt include all components Active is a duplicate bug report!
Tom, could you take a look at this today? ๐
- ๐ฎ๐ณIndia amangrover90
Uploaded the payload for which there was 500 error. It fails trying to calculate the regionForComponentId.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This blocks #3535078, see #3535078-9: [PP-1] Created XB Pattern didnโt include all components โ . More likely: that is a duplicate of this issue: different symptom, same root cause. Still, let's double-check there after this lands ๐
- First commit to issue fork.
- Merge request !1262Issue #3534971: Detect component Uuid in nested components. โ (Merged) created by isholgueras
- ๐ช๐ธSpain isholgueras
This is ready with all tests green. Let me know if we can create a follow-up ticket for tests or if we should include here the tests
- First commit to issue fork.
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
I think this should be a beta blocker, its pretty easy to get this error.
Pushed a failing test and rebased off 0.x
If you checkout 185d8c32 and run ApiLayoutControllerPatchTest it fails.
We already had most of the required structure in XbTestSetup, just needed to do some fernangling to mirror the nesting.
Adding the tag, asking for forgiveness not permission etc
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
2 questions on the MR โ one about a remaining
@todo
, one about something I don't understand. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks!
Landing ๐ Add rudimentary conflict prevention to the Config Auto-save end-point Active first though.
- ๐ช๐ธSpain isholgueras
โฆ but let's land !1204 first, that is much harder to reroll.
Sure! feel free to throw it back to me if we need a reroll here.
- ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
I have a follow-up MR ready at https://git.drupalcode.org/project/experience_builder/-/merge_requests/1269.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ Add rudimentary conflict prevention to the Config Auto-save end-point Active is in! Merging this as soon as CI passes.
@penyaskito THAT WAS FAST ๐ฑ
-
wim leers โ
committed ceb5edde on 0.x authored by
isholgueras โ
Issue #3534971 by isholgueras, larowlan, amangrover90, wim leers,...
-
wim leers โ
committed ceb5edde on 0.x authored by
isholgueras โ
Automatically closed - issue fixed for 2 weeks with no activity.