0

On a Magento v2.4.1 site, when trying to authorise an existing integration record, I'm receiving the error "Integration ID is not specified or is invalid".

Magento admin - integrations page

I verified that the record does have an ID set - it's set to 0. I'm assuming that is a valid ID?

I'm not sure where to start with diagnosis unfortunately - can anyone suggest where to start looking?

Thanks!

1

I suspect that the ID of 0 is your problem. From \Magento\Integration\Controller\Adminhtml\Integration\Edit:

$integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID);
        if ($integrationId) {
            //stuff happens
        } else {
            $this->messageManager->addErrorMessage(__('Integration ID is not specified or is invalid.'));
            $this->_redirect('*/*/');
            return;
        }

I would expect PHP to interpret an integer of zero as a boolean of false, causing the condition to fail and throwing your error. I would expect any ID other than 0 to work. Since I don't see that the integration.integration_id field is a key for any other field, you may be able to change that value right in the database and see if that helps.

11
  • I tried updating the ID to 1 and authorise. This time I get "Internal error. Check exception log for details.". Exception.log isn't written to at all however... Weird. – gpcola May 11 at 0:06
  • After testing on my own instance, I believe changing the ID to a non-zero integer is the correct resolution to your OP, and that this is a new problem. I agree it's weird that a critical-level error isn't written to exception.log. For now, you may have success adding a temporary debug logger in Magento\Integration\Controller\Adminhtml\Integration\Edit. If that's where the error is thrown, then inserting this between Lines 33 & 34 might at least get it into debug.log so you can see it: \Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class)->debug($e); – kookaburra May 11 at 16:12
  • I figured out why no exeption.log was being generated - this was a completely unrelated issue. Entries in exception.log look like this "[2021-05-11 21:13:18] main.CRITICAL: The role wasn't found for the user. Verify the role and try again. {"exception":"[object] (Magento\\Framework\\Exception\\AuthorizationException(code: 0): The role wasn't found for the user. Verify the role and try again. at /home/cpaccount/public_html/m2dev/vendor/magento/module-authorization/Model/Acl/AclRetriever.php:86)"} []". There is only one role defined - administrator - all users are assigned to this. – gpcola May 11 at 21:28
  • I see that every integration record added is created with an integration_id set to 0. This is clearly incorrect. Is that column in the table integration not meant to be set to Auto Increment? I'm beginning to worry that the InnoDB table definition may be corrupted in some way. – gpcola May 11 at 21:41
  • As a workaround I managed to use this code to create an authorised integration successfully. That said, I still need to figure out what the issue is here, and to resolve the question of whether or not integration.integration_id should be set to Auto Increment or not. – gpcola May 12 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.