Warning: Attempt to read property "id" on string in Drupal\sendpulse_api\Service\SendpulseApi->getMailingLists()

Created on 10 December 2024, 9 days ago

Problem/Motivation

After clearing the cache on my site, I got a white screen with an error:"Uncaught PHP Exception Exception: "Could not connect to api, check your ID and SECRET" at /home/u540084/mysite.ru/www/modules/contrib/sendpulse_api/src/Plugin/ApiClient.php line 64"

After that, I just can't get the site back online. I checked the secret key and ID - everything is fine, they have not changed. I tried to register them directly in Setting - it also didn't help. After that, I deleted the line specified in the error from the file ApiClient.php. It helped and I saw the real cause of the problems instead of the white screen.:"Warning: Attempt to read property "id" on string in Drupal\sendpulse_api\Service\SendpulseApi->getMailingLists() (line 549 of modules/contrib/sendpulse_api/src/Service/SendpulseApi.php)."

Address books are missing in the module settings, they are not loaded from the Sendpulse website.

Steps to reproduce

Drupal 9.5.11. I use the type of materials that unauthorized users can add. There I add an invisible field with the type "Sendpulse Api Lists".

At the moment, it is not possible to specify in the field which address book the data will be sent to. But users can still create a type of material without getting any errors.

Proposed resolution

There was probably some kind of API update. It is necessary to correct the request and fix the problem when an invalid key prevents you from using the site after clearing the cache, causing a white screen.

🐛 Bug report
Status

Needs work

Version

1.1

Component

Code

Created by

🇷🇺Russia mr.pomelov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mr.pomelov
  • 🇷🇺Russia mr.pomelov

    I found out the reason for this behavior of the module - the IP address of the server where my site is located was blocked on SendPulse, so API requests did not go there.

    u540084@red31:~$ curl -v https://api.sendpulse.com
    * Rebuilt URL to: https://api.sendpulse.com/
    * Trying 188.40.60.215...
    * TCP_NODELAY set
    * connect to 188.40.60.215 port 443 failed: Connection timed out
    * Failed to connect to api.sendpulse.com port 443: Connection timed out
    * Closing connection 0
    curl: (7) Failed to connect to api.sendpulse.com port 443: Connection timed out

    But this should not lead the site to a white screen, without the possibility of somehow influencing the situation through the user interface.

Production build 0.71.5 2024