Skip to content

Error Occurs While Connecting ActiveCampaign Module. #101

@dhruvi-prajapat1

Description

@dhruvi-prajapat1

Module Version: 2.1.27
Magento Version: 2.4.6-p6

Issue Description:
When attempting to connect the module, an error is displayed:
Error :- “A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.”
In the shop exception.log, the following error appears:

TypeError: ActiveCampaign\Core\Helper\Data::getStoreLogo(): Argument#1 ($scopeCode) must be of type ?string, int given, called in /vendor/activecampaign/module-integration/Core/Controller/Adminhtml/System/Config/Connect.php on line 236 and defined in /vendor/activecampaign/module-integration/Core/Helper/Data.php:121

Screenshot-1: Error

Image

Steps to Reproduce:

  1. Take a shop.
  2. Install “activecampaign/module-integration” module and run setup command.
  3. In the Admin -> Store -> Configuration -> ActiveCampaign -> Configuration -> General -> API key
  4. Enter the API key and click the Connect button.
  5. The error appears.

Expected Results:
The connection should be established successfully without any errors.

Actual Results:
An error is thrown after clicking the Connect button.

Additional Information:-
While debugging, I found that in the file vendor/activecampaign/module-integration/Core/Helper/ Data.php there is a function called getStoreLogo(). As shown in Screenshot-2, the $scopeCode parameter defined as a nullable string (?string). This means when $scopeCode receives its value from the configuration, it can only return a string or null. However, in the default Magento implementation, $scopeCode can return an integer, a string, or null.

Also, as you can see in ScreenShot-3 the function getStoreLogo() is called from the file
vendor/activecampaign/module-integration/Core/Controller/Adminhtml/System/Config/Connect.php

within the CurlRequestData() method, where a store ID (integer) is passed instead of a string.Since the method strictly expects a string or null, passing an integer results in a TypeError.

Screenshot-2 :- Code Reference

Image

Screenshot-3 :- Code Reference

Image

Suggested Solution :-
The $scopeCode parameter should not be strictly limited to ?string. It should allow int, string, or null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions