sunnysideup / silverstripe-campaignmonitor-api

Provides the api for campaign monitor
Other
0 stars 0 forks source link

Errors on PHP8.1.13 & SS ~4.13.0@stable #1

Open MarkCondello opened 9 months ago

MarkCondello commented 9 months ago

error-log.ERROR: Uncaught Exception Error: "Class "Sunnysideup\CampaignMonitor\Api\CS_REST_General" not found" at WEBSITE/vendor/sunnysideup/campaignmonitor/src/Api/CampaignMonitorAPIConnector.php line 1675 {"exception":"[object] (Error(code: 0): Class \"Sunnysideup\CampaignMonitor\Api\CS_REST_General\" not found at WEBSITE/vendor/sunnysideup/campaignmonitor/src/Api/CampaignMonitorAPIConnector.php:1675)"} []

error-log.WARNING: E_WARNING: Undefined property: stdClass::$Code {"code":2,"message":"Undefined property: stdClass::$Code","file":"WEBSITE/vendor/sunnysideup/campaignmonitor/src/Api/CampaignMonitorAPIConnector.php","line":1692} []

error-log.WARNING: E_DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated {"code":8192,"message":"strlen(): Passing null to parameter #1 ($string) of type string is deprecated","file":"WEBSITE/vendor/sunnysideup/campaignmonitor/src/CampaignMonitorSignupPage.php","line":436} []

object(CS_REST_Wrapper_Result)#6162 (2) { ["response"]=> object(stdClass)#6154 (2) { ["error"]=> string(15) "invalid_request" ["error_description"]=> string(37) "Required parameters were not supplied" } ["http_status_code"]=> int(400) }

Errors relating to missing templates when trying to publish a Newsletter Sign Up page: [User Warning] None of the following templates could be found: Array ( [0] => Array ( [type] => Includes [0] => CampaignMonitorSignupPageContentInner ) [1] => CampaignMonitorSignupPageContentInner ) in themes "Array ( [0] => $public [1] => chu [2] => $default ) "

sunnysideup commented 9 months ago

@MarkCondello - I will check this out ASAP.

sunnysideup commented 9 months ago

@MarkCondello , I would firstly upgrade to the latest version. We are running this on production.

If you like, you can call me +64221697577 during NZ business hours for help OR I can set up an example for you.

Basically, what I would do this is:

composer require sunnysideup/campaignmonitor:dev-master

and then adjust, as required.

Does that help?

MarkCondello commented 9 months ago

Hey there, I deleted package.lock and ran the install:

Screenshot 2023-12-08 at 8 59 31 am

Obv, that does not help.

sunnysideup commented 9 months ago

Hi Mark,

From what I can tell you can add this to your composer file to make this go away:

    "minimum-stability": "dev",
    "prefer-stable": true,

CGPT SAYS:

To change the minimum stability to allow dev packages in Composer, update your composer.json file like this:

{ "minimum-stability": "dev" } This will set the minimum stability for all packages to dev. Remember, this can also allow unstable versions of other packages, not just the ones you specifically want in dev version.

sunnysideup commented 9 months ago

Once we have got you up and running, we can then lock it to a version.

MarkCondello commented 9 months ago

I have installed the latest through Composer and followed your docsfor a quick setup and the template issue remains.

Please see a screenshot of the issue from the CMS: Screenshot 2023-12-09 at 10 07 53 pm

Its worth noting that the WYSIWYG is not loading for Newsletter sign-up pages and only shows after saving content. We are also only able to save changes and not able publish them.

Please advise on what we can do to have a working version of your module..

I have also created a CampaignMonitorSignupPage.ss template assuming that is the required template for the Page type.

sunnysideup commented 9 months ago

I have set up a demo site and I will fix up any issues you may have:

https://github.com/sunnysideup/silverstripe-campaignmonitor-demo

I will see if I can put up a working demo ASAP.

sunnysideup commented 9 months ago

Hi @MarkCondello - please have a look at the demo. Make sure you add your api key, etc...

Sunnysideup\CampaignMonitorApi\Api\CampaignMonitorAPIConnectorBase:
  client_id: 'aaa'
  api_key: 'yyy'
sunnysideup commented 9 months ago

If you find any further issues then please let me know and I will fix them.

MarkCondello commented 9 months ago

I cloned the repo and added the standard setup for your extension which I did in my other project. There are issues reading the config settings. The API details are not getting read and I have tried both the .yml and .env options. Please see the screenshot for details:

Screenshot 2023-12-11 at 9 49 42 am Screenshot 2023-12-11 at 9 47 33 am
sunnysideup commented 9 months ago

I will check this out. Did you do a flush=all.

MarkCondello commented 9 months ago

I performed a flush both in the browser and through sake.

MarkCondello commented 9 months ago

My mistake, I added the API key incorrectly to the .env. I can render forms from the predefined list using the code base you provided. There must be an issue with the other project settings.

sunnysideup commented 9 months ago

I will see if I can set up a working demo for you and then you can compare all the required settings.

sunnysideup commented 9 months ago

Hi Mark,

I got roped into other work. Do you still need to see a demo or do you need any other help?

MarkCondello commented 8 months ago

Hi there,

I had another look into your package lately and unfort its still not performing properly.

I have new Newsletter sign-up page pulling in my mail lists from Campaign Monitor and I see the form on the front end. When submitting the form it produces a 500 error. Please see the screenshot for the details: 500-error

As you can see the form navigates to the thank you page, but of course no entry is added in Campaign Monitor due to the missing SignupForm endpoint.

I reviewed the docs and I feel like they need more work as it's not 100% clear the steps involved to use the package correctly. Also, this link in the readme leads to 404's: https://github.com/sunnysideup/silverstripe-campaignmonitor-api/blob/master/docs/en/userguide.md

Can you please advise how I can resolve the 500 error? Talk soon.

sunnysideup commented 8 months ago

Can you show errors, so that you can show the error rather than just the 500 error?

MarkCondello commented 8 months ago

campaign-monitor-ss-error Here you go.

sunnysideup commented 8 months ago

Thank you. This is a deprecated function in the code of Campaign Monitor itself. So we need to upgrade CM's version. These errors should not show up in a production environment as they are warnings about future changes.

Here is the actual code: https://github.com/campaignmonitor/createsend-php/blob/master/class/serialisation.php#L38. They have not fixed this yet.

Their code is not very "best practice"; it is a bit hacky. If you know of a better core library then I would be interested in swapping out to it.