Fatal error trying to add HubSpot handler in webform

Created on 19 September 2023, over 1 year ago

Problem/Motivation

Getting a fatal error when adding Hubspot webform handler.

Fatal error: Declaration of SevenShores\Hubspot\Http\Response::getStatusCode() must be compatible with Psr\Http\Message\ResponseInterface::getStatusCode(): int in /app/vendor/hubspot/hubspot-php/src/Http/Response.php on line 326

Drupal version: 10.1.3
Webform: 6.2.0-beta6
Hubspot: 3.0.0-alpha2

Steps to reproduce

  • Create a webform
  • Under settings, Emails / Handlers, click on Add handle
  • Right click on the "Add handler" button and open link on a new tab, instead of clicking on the button.
  • The webform handler options will show on a new tab / window instead of showing on an ui dailog.
  • Click "HubSpot Webform Handler"

Getting an error on screen:
Fatal error: Declaration of SevenShores\Hubspot\Http\Response::getStatusCode() must be compatible with Psr\Http\Message\ResponseInterface::getStatusCode(): int in /app/vendor/hubspot/hubspot-php/src/Http/Response.php on line 326

Proposed resolution

The hubspot-php library suggests to lock psr/http-message o version v1.1.
https://github.com/HubSpot/hubspot-php/commit/b54c24bbb6585bddf358103ff6...

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia kelvinwong

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

Comments & Activities

  • Issue created by @kelvinwong
  • Status changed to Needs review over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia kelvinwong

    Patch provided to lock psr/http-message to version v1.1.

  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    I ran into this same thing trying to edit an existing handler. Exactly the same modules version as in the IS.

    I added required psr/http-message:^1.1 in my project and that has fixed the bug. It would be great to see this patch committed. Thanks!

  • Assigned to Kostiantyn
  • Status changed to Needs work about 2 months ago
  • πŸ‡ΊπŸ‡¦Ukraine Kostiantyn

    We just need to update the dependencies in the module's composer file to a newer version of the library, as they fixed it.
    https://github.com/HubSpot/hubspot-php/pull/420

  • πŸ‡ΊπŸ‡¦Ukraine Kostiantyn

    I’ve created a patch and need a review.

  • πŸ‡«πŸ‡·France chauvirea Cholet

    Hi,
    I'm new to Drupal (1 year's experience).
    I have a site factory with Drupal 10.2.6.
    I have installed version 3.0.0 Alpha 4 of the module.
    Do I just need to install this patch https://www.drupal.org/files/issues/2025-01-02/updated-hubspot-php-libra... β†’ ?
    Best regards

  • πŸ‡¬πŸ‡§United Kingdom thetwentyseven

    After I install the module with composer composer require 'drupal/hubspot:^3.0@alpha' and I add patch number #5, I do still have version of hubspot/hubspot-php 3.2.1 and not 5.3

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    Can place this in your composer.json:
    "hubspot/hubspot-php": "5.3 as 3.2",

  • πŸ‡ΊπŸ‡¦Ukraine Kostiantyn

    @chauvirea and @thetwentyseven after applying the patch, it will not take effect locally (it is only for the module developer to make changes more easily and quickly).
    The patch does not work because when installing dependencies, Composer does not look at the local composer.json file inside the module folder but rather at the one in the remote repository. Therefore, any changes you make to the file: /web/modules/contrib/hubspot/composer.json will not be applied.
    You can manually modify composer.lock in your project and change the version of the hubspot-php library (e.g., "hubspot-php": "^5.3") by replacing it with a different version. However, this is a poor solution and should only be done by those who fully understand the implications.

Production build 0.71.5 2024