diff --git a/vendor/magento/module-customer/Model/App/Action/ContextPlugin.php b/vendor/magento/module-customer/Model/App/Action/ContextPlugin.php
index 5d926b47ca44..03219ab1935b 100644
--- a/vendor/magento/module-customer/Model/App/Action/ContextPlugin.php
+++ b/vendor/magento/module-customer/Model/App/Action/ContextPlugin.php
@@ -48,7 +48,7 @@ public function beforeExecute(ActionInterface $subject)
     {
         $this->httpContext->setValue(
             Context::CONTEXT_GROUP,
-            $this->customerSession->getCustomerGroupId(),
+            (string)$this->customerSession->getCustomerGroupId(),
             GroupManagement::NOT_LOGGED_IN_ID
         );
         $this->httpContext->setValue(
diff --git a/vendor/magento/module-customer/Model/Session.php b/vendor/magento/module-customer/Model/Session.php
index d0115dbee72b..da094fbb9e6c 100644
--- a/vendor/magento/module-customer/Model/Session.php
+++ b/vendor/magento/module-customer/Model/Session.php
@@ -211,7 +211,7 @@ public function setCustomerData(CustomerData $customer)
         } else {
             $this->_httpContext->setValue(
                 Context::CONTEXT_GROUP,
-                $customer->getGroupId(),
+                (string)$customer->getGroupId(),
                 \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID
             );
             $this->setCustomerId($customer->getId());
@@ -271,7 +271,7 @@ public function setCustomer(Customer $customerModel)
         $this->_customerModel = $customerModel;
         $this->_httpContext->setValue(
             Context::CONTEXT_GROUP,
-            $customerModel->getGroupId(),
+            (string)$customerModel->getGroupId(),
             \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID
         );
         $this->setCustomerId($customerModel->getId());
