Error 500 when posting form from incognito mode on Chrome (hubspotutk)

Gaston_Yelmini
New Member

Hi!

Our server is getting a 500 error when a form is posted from incognito mode in Chrome. This error references the cookie "hubspotutk" as undefined.

[2018-08-11 19:56:09] production.ERROR: Undefined index: hubspotutk {"exception":"[object] (ErrorException(code: 0): Undefined index: hubspotutk at /home/forge/latio.co/app/Http/Controllers/Programs/Lead$ [stacktrace]

Has anyone had the same problem?

Thanks!

Reply
0 Upvotes
4 Replies 4
Derek_Gervais
HubSpot Moderator

Hi @Gaston_Yelmini,

If the form is being posted from an ingocnito browser, it's possible that the visitor doesn't have a hubspotutk cookie. While this should not cause a 500 error response from HubSpot, it's possible that it's causing an error in your code since you're explicitly setting the $hubspotutk variable. Can you try the submission in an incognito window after confirming that the hubspotuk cookie exists using the Chrome dev tools?

Reply
0 Upvotes
Gaston_Yelmini
New Member

Hi @Derek_Gervais, thank you for your answer.

I made a post and I can see that the hubspotutk cookie is missing. How should I handle this when its missign?

Thank you again.

Reply
0 Upvotes
Derek_Gervais
HubSpot Moderator

Hi @Gaston_Yelmini,

I'm not particularly familiar with PHP, but after you set the variable can you check to see if it has a value? If there is no hubspotutk value, you shouldn't include it in the form submission.

Reply
0 Upvotes
benvanlooy
Esteemed Contributor | Gold Partner

Make sure your hubspot code is on the page & make sure the cookie is set.

 

However, if you want to get around this for now, you can always check if the cookie is set & then pass the value or just an empty value..

$hubspotutk = isset($_COOKIE['hubspotutk']) ? $_COOKIE['hubspotutk'] : '';