# HubSpot App - v1.2.4 - Internal Error

**URL:** <https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310>\
**Category:** Product Support\
**Created:** [January 26, 2016, 3:25am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310 "2016-01-26T03:25:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 26, 2016, 3:25am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/1 "2016-01-26T03:25:42Z")

</div>

Hi Guys,  
  
  
  
I updated to version 1.2.4 earlier today and it has broken the HubSpot App / Plugin for me. I’m now receiving the below error when opening the plugin.  
  
  
  
 ![](http://colourfulowl.com/images/mautic-error-hubspot.PNG)  
  
  
  
Not sure if this is affecting anyone else.  
  
  
  
Kind regards,  
  
  
  
Nate C.

---

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 26, 2016, 3:25am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/2 "2016-01-26T03:25:42Z")

</div>

Hi Guys,

I updated to version 1.2.4 earlier today and it has broken the HubSpot App / Plugin for me. I’m now receiving the below error when opening the plugin.

![](http://colourfulowl.com/images/mautic-error-hubspot.PNG)

Not sure if this is affecting anyone else.

Kind regards,

Nate C.

---

<div class="post-metadata">

**Author:** ![gmillard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gmillard/32/5_2.png) [@gmillard](https://forum.mautic.org/u/gmillard)\
**Post date:** [January 26, 2016, 3:27am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/3 "2016-01-26T03:27:01Z")

</div>

Hi Nate,

Can you check Mautic’s logs to see what is causing the uh oh? It should be listed under System Info -\> Logs or you can check app/logs on the filesystem.

Thanks!  
Alan

---

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 26, 2016, 3:32am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/4 "2016-01-26T03:32:27Z")

</div>

Hi Alan,

Thanks for getting back to me so quickly.

The log states:

[2016-01-26 03:29:42] mautic.NOTICE: PHP Notice: Undefined index: path - in file /opt/bitnami/apps/mautic/htdocs/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 98 [] []  
[2016-01-26 03:30:17] mautic.NOTICE: PHP Notice: Undefined index: name - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 99 [] []  
[2016-01-26 03:30:17] mautic.NOTICE: PHP Notice: Undefined index: label - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 101 [] []  
[2016-01-26 03:30:17] mautic.NOTICE: PHP Notice: Undefined index: label - in file /opt/bitnami/apps/mautic/htdocs/app/bundles/PluginBundle/Form/Type/FieldsType.php - at line 34 [] []  
[2016-01-26 03:30:17] mautic.CRITICAL: Uncaught PHP Exception SymfonyComponentFormExceptionLogicException: “A form with an empty name cannot have a parent form.” at /opt/bitnami/apps/mautic/htdocs/vendor/symfony/form/Symfony/Component/Form/Form.php line 272 {“exception”:"[object] (Symfony\Component\Form\Exception\LogicException(code: 0): A form with an empty name cannot have a parent form. at /opt/bitnami/apps/mautic/htdocs/vendor/symfony/form/Symfony/Component/Form/Form.php:272)"} []

Not sure if that is of any use.

kind regards,

Nate C.

---

<div class="post-metadata">

**Author:** ![gmillard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gmillard/32/5_2.png) [@gmillard](https://forum.mautic.org/u/gmillard)\
**Post date:** [January 26, 2016, 3:40am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/5 "2016-01-26T03:40:54Z")

</div>

Did you by chance change any of your lead fields in Hubspot? Based on that error trail, it seems Hubspot API is returning something that has an empty name and label leading to a bad form field and then the uncaught exception. No clue what’s being returned though.

You can try adding this line of code here [https://github.com/mautic/mautic/blob/db0ab91c353e36fbbaf06480f2895904f40e84ee/plugins/MauticCrmBundle/Integration/HubspotIntegration.php#L96](https://github.com/mautic/mautic/blob/db0ab91c353e36fbbaf06480f2895904f40e84ee/plugins/MauticCrmBundle/Integration/HubspotIntegration.php#L96)

```auto
$this->factory->getLogger()->log('error', print_r($leadFields, true));
```

Open the plugin configuration to trigger the error then check your log to see what was recorded. Create a bug report at [https://github.com/mautic/mautic/issues](https://github.com/mautic/mautic/issues) with the errors along with what was recorded by the above change.

Thanks!  
Alan

---

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 26, 2016, 4:01am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/6 "2016-01-26T04:01:35Z")

</div>

I’ve followed what you suggest above, however, since adding that line of code i can’t get the plugin page to open. If i go directly to the url /s/plugins I get the following:

![](http://colourfulowl.com/images/mautic-error-plugins-page.PNG)  
Error returned:

[2016-01-26 03:56:53] mautic.ERROR: Fatal: Namespace declaration statement has to be the very first statement in the script - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 25 [] []  
[2016-01-26 03:57:01] mautic.ERROR: Fatal: Namespace declaration statement has to be the very first statement in the script - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 25 [] []  
[2016-01-26 03:57:08] mautic.ERROR: Fatal: Namespace declaration statement has to be the very first statement in the script - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 25 [] []

Nate C.

---

<div class="post-metadata">

**Author:** ![gmillard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gmillard/32/5_2.png) [@gmillard](https://forum.mautic.org/u/gmillard)\
**Post date:** [January 26, 2016, 4:42am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/7 "2016-01-26T04:42:21Z")

</div>

It kind of reads like maybe something extra was added on accident. Check around and before line 25. Was something accidentally added?

---

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 26, 2016, 5:20am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/8 "2016-01-26T05:20:38Z")

</div>

hmm, at the top of the document there was this:

Skip to content  
Sign up Sign in  
This repository  
Search  
Explore  
Features  
Enterprise  
Pricing  
Watch 83 Star 518 Fork 179 mautic/mautic  
Code Issues 278 Pull requests 20 Pulse Graphs  
Tree: db0ab91c35 Find file Copy pathmautic/plugins/MauticCrmBundle/Integration/HubspotIntegration.php  
db0ab91 on 28 Oct 2015  
Gabriel Passarelli Code Review  
0 contributors  
RawBlameHistory 159 lines (140 sloc) 3.37 KB

\<?php /\*\* \* @copyright 2014 Mautic Contributors. All rights reserved. \* @author Mautic .... I've replaced the document with one from current 1.2.4 download and it's 'fixed' that issue but I'm still getting the server error when opening the HubSpot plugin. Log Code: [2016-01-26 05:11:32] mautic.ERROR: Fatal: syntax error, unexpected 'API' (T\_STRING) - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 142 [] [] [2016-01-26 05:12:01] mautic.ERROR: Fatal: Namespace declaration statement has to be the very first statement in the script - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 25 [] [] [2016-01-26 05:14:20] mautic.NOTICE: PHP Notice: Undefined index: name - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 99 [] [] [2016-01-26 05:14:20] mautic.NOTICE: PHP Notice: Undefined index: label - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 101 [] [] [2016-01-26 05:14:20] mautic.NOTICE: PHP Notice: Undefined index: label - in file /opt/bitnami/apps/mautic/htdocs/app/bundles/PluginBundle/Form/Type/FieldsType.php - at line 34 [] [] [2016-01-26 05:14:20] mautic.CRITICAL: Uncaught PHP Exception SymfonyComponentFormExceptionLogicException: "A form with an empty name cannot have a parent form." at /opt/bitnami/apps/mautic/htdocs/vendor/symfony/form/Symfony/Component/Form/Form.php line 272 {"exception":"[object] (Symfony\Component\Form\Exception\LogicException(code: 0): A form with an empty name cannot have a parent form. at /opt/bitnami/apps/mautic/htdocs/vendor/symfony/form/Symfony/Component/Form/Form.php:272)"} []

---

<div class="post-metadata">

**Author:** ![gmillard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gmillard/32/5_2.png) [@gmillard](https://forum.mautic.org/u/gmillard)\
**Post date:** [January 26, 2016, 4:02pm UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/9 "2016-01-26T16:02:32Z")

</div>

Yea, looks like something was accidentally copied in. Maybe you copied in the github link I had here? If so, that was just meant to be a reference to where to add the line of code I gave. Open the same file (plugins/MauticCrmBundle/Integration/HubspotIntegration.php) in your Mautic installation and find line 96. Copy and paste into that blank line:

```auto
$this->factory->getLogger()->log('error', print_r($leadFields, true));
```

Then try to repeat the issue and see what’s logged.

---

<div class="post-metadata">

**Author:** ![ulsegundo](https://avatars.discourse-cdn.com/v4/letter/u/e19b73/32.png) [@ulsegundo](https://forum.mautic.org/u/ulsegundo)\
**Post date:** [January 29, 2016, 2:40am UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/10 "2016-01-29T02:40:15Z")

</div>

I am having the exact same issue. When I click on the hub spot icon, it gives me the same error. I am hoping that there is a solution soon. Thankyou…

---

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 31, 2016, 3:46pm UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/11 "2016-01-31T15:46:30Z")

</div>

Hi, Sorry for the delay, the day job keeps getting in the way \>\_\<

I followed what you said to do Alan and here’s the error log returned.

Nothing inside HubSpot has been updated, it’s using the default, free HubSpot CRM account without any alterations. I’m wondering if the API key I put in had a space at the end?

[2016-01-31 15:41:38] mautic.ERROR: Array ( [error] =\> Array ( [message] =\> Keys are not available for this transaction to take place. Please verify your settings then try again. ) ) [] []  
[2016-01-31 15:41:38] mautic.NOTICE: PHP Notice: Undefined index: name - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 99 [] []  
[2016-01-31 15:41:38] mautic.NOTICE: PHP Notice: Undefined index: label - in file /opt/bitnami/apps/mautic/htdocs/plugins/MauticCrmBundle/Integration/HubspotIntegration.php - at line 101 [] []  
[2016-01-31 15:41:38] mautic.NOTICE: PHP Notice: Undefined index: label - in file /opt/bitnami/apps/mautic/htdocs/app/bundles/PluginBundle/Form/Type/FieldsType.php - at line 34 [] []  
[2016-01-31 15:41:38] mautic.CRITICAL: Uncaught PHP Exception SymfonyComponentFormExceptionLogicException: “A form with an empty name cannot have a parent form.” at /opt/bitnami/apps/mautic/htdocs/vendor/symfony/form/Symfony/Component/Form/Form.php line 272 {“exception”:"[object] (Symfony\Component\Form\Exception\LogicException(code: 0): A form with an empty name cannot have a parent form. at /opt/bitnami/apps/mautic/htdocs/vendor/symfony/form/Symfony/Component/Form/Form.php:272)"} []

I’ll create a case on GitHub shortly.

Kind regards,

Nate C.

---

<div class="post-metadata">

**Author:** ![Cyanstar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cyanstar/32/53_2.png) [@Cyanstar](https://forum.mautic.org/u/Cyanstar)\
**Post date:** [January 31, 2016, 3:53pm UTC](https://forum.mautic.org/t/hubspot-app-v1-2-4-internal-error/3310/12 "2016-01-31T15:53:37Z")

</div>

Nevermind, after digging around in Github I found the solution Alan provided to someone else. If you’ve having this issue take a look at the suggestion [here.](https://github.com/mautic/mautic/issues/1391)

As a quick summary, you need to revert one of your encryptions helpers. Which can be located here:

/htdocs/app/bundles/CoreBundle/Helper - EncryptionHelper.php

Replaced the entire document with the one linked on the suggestion page. I’ll put it below too.

Kind regards,

Nate C.

Previously version of EncryptionHelper.php.

\<?php /\*\* \* @package Mautic \* @copyright 2014 Mautic Contributors. All rights reserved. \* @author Mautic \* @link http://mautic.org \* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html \* \* http://www.warpconduit.net/2013/04/14/highly-secure-data-encryption-decryption-made-easy-with-php-mcrypt-rijndael-256-and-cbc/ \*/ namespace MauticCoreBundleHelper; use MauticCoreBundleFactoryMauticFactory; class EncryptionHelper { private $key; /\*\* \* @param MauticFactory $factory \* \* @throws RuntimeException if the mcrypt extension is not enabled \*/ public function \_\_construct(MauticFactory $factory) { // Toss an Exception back if mcrypt is not found if (!extension\_loaded('mcrypt')) { throw new RuntimeException($factory-\>getTranslator()-\>trans('mautic.core.error.no.mcrypt')); } $this-\>key = $factory-\>getParameter('secret\_key'); } /\*\* \* Returns a 64 character string \* \* @return string \*/ static public function generateKey() { return hash('sha256', uniqid(mt\_rand(), true)); } /\*\* \* Encrypt string \* \* @param $encrypt \* \* @return string \*/ public function encrypt ($encrypt) { $encrypt = serialize($encrypt); $iv = mcrypt\_create\_iv(mcrypt\_get\_iv\_size(MCRYPT\_RIJNDAEL\_256, MCRYPT\_MODE\_CBC), MCRYPT\_DEV\_URANDOM); $key = pack('H\*', $this-\>key); $mac = hash\_hmac('sha256', $encrypt, substr(bin2hex($key), -32)); $passcrypt = mcrypt\_encrypt(MCRYPT\_RIJNDAEL\_256, $key, $encrypt . $mac, MCRYPT\_MODE\_CBC, $iv); $encoded = base64\_encode($passcrypt) . '|' . base64\_encode($iv); return $encoded; } /\*\* \* Decrypt string \* \* @param $decrypt \* \* @return bool|mixed|string \*/ public function decrypt ($decrypt) { $decrypt = explode('|', $decrypt . '|'); $decoded = base64\_decode($decrypt[0]); $iv = base64\_decode($decrypt[1]); if (strlen($iv) !== mcrypt\_get\_iv\_size(MCRYPT\_RIJNDAEL\_256, MCRYPT\_MODE\_CBC)) { return false; } $key = pack('H\*', $this-\>key); $decrypted = trim(mcrypt\_decrypt(MCRYPT\_RIJNDAEL\_256, $key, $decoded, MCRYPT\_MODE\_CBC, $iv)); $mac = substr($decrypted, -64); $decrypted = substr($decrypted, 0, -64); $calcmac = hash\_hmac('sha256', $decrypted, substr(bin2hex($key), -32)); if ($calcmac !== $mac) { return false; } $decrypted = unserialize($decrypted); return $decrypted; } }
