APIs & Integrations

narainsagar
Participant

Webhook test returns 500 error

SOLVE

Hello Community, 

 

FYI: I have also posted it here: https://community.hubspot.com/t5/APIs-Integrations/Webhook-test-returning-500-Error/m-p/292695/highl...

 

I am having the issue while creating webhook and test returns 500 error..

 

Here's my application webhook subscription URL:

https://app.hubspot.com/developer/6299815/application/200930/webhooks

 

Here's my webhook POST method handler API endpoint:

https://staging.dotandlinelearning.com/backend/api/hubspot/webhook

 

^ This POST method actually fetches the deal information and associated contact information from through the payload->objectId and saves the fetched information into my DB table..

 

Here's the test response; I get:

{ "statusCode": 500 }

 

You may also check this screenshot: webhook testwebhook test

 

Following is my ssl certificate info screenshot:

 

Screen Shot 2019-09-23 at 7.03.39 PM.png

 

UPDATED: 

Moreover; According to this solution by @bkucenski I also have changed the SSL certificate from wildcard to single site SSL but still it doesn't work for me i.e., returning the same 500 error.

P.S. Here's the single site SSL info:

 

Screen Shot 2019-09-24 at 5.53.10 PM.png

 

I 'd like this be working as soon as possible, could anyone please help me fix this issue.

 

Thanks.

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hi, @narainsagar.

 

Sorry for the spam/abuse trouble. I've found that this platform tends to flag posts with either large or many code blocks and/or multiple screenshots, even if they're not malicious. It looks like one of my colleagues restored your posts, so we can continue speaking here.

 

I'm glad to see that you got the tests to work in Postman!

 

In order for your application to detect dealstage property changes and send your webhook URL a notification, your app must be connected to your developer test account. I can see that your app with an ID ending in 0930 is not connected to any HubSpot account at this time.

 

You can connect your app to an account through this OAuth flow.

Isaac Takushi

Associate Certification Manager

View solution in original post

12 Replies 12
IsaacTakushi
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hi again, @narainsagar.

 

Let's move the conversation into this new thread. Here's how I responded to your other post earlier today:

 

I'm sorry to hear that you're encountering these 500 errors, even after trying the recommendations above.

 

I haven't diagnosed the cause yet, but could you help me by answering a few clarifying questions?

  1. Are you able to successfully POST the sample data through a REST client like Postman?
  2. Per the original poster's comment, does the same webhook URL work in a workflow webhook action? You should have access to workflows in your developer test account ending in 9821.

Isaac Takushi

Associate Certification Manager
0 Upvotes
narainsagar
Participant

Webhook test returns 500 error

SOLVE

Hello Isaac,

Thanks for the reply.

 

Re. your questions:

1. Yes - I am able to POST sample data through REST API client like Postman etc.

2. Yes - the same webhook URL work in a workflow webhook action.

 

Cheers,

Narain

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hey, @narainsagar.

 

Thanks so much for confirming. I'll work with my team to get to the bottom of this. I apologize for the inconvenience.

Isaac Takushi

Associate Certification Manager
narainsagar
Participant

Webhook test returns 500 error

SOLVE

Hello Isaac,

 

Thanks for the response. I'll wait for your update on this issue.

 

Also I want to know; will I be need a paid version of hubspot to get the webhooks work through hubspot developer portal application?

 

Currently our business needs doesn't require any of the paid features so just for this single feature i.e., webhooks to trigger; I don't think we can upgrade to enterprise paid plan.

 

FYI. Since - webhooks under workflow action requires enterprise plan. which is a huge amount in its own.

 

Also, if it is possible to use webhooks for free then what will be the limitations etc?

 

Would really appreciate if you could give your thoughts on this ^?

 

Cheers,

Thanks.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hi, @narainsagar.

 

I don't have any updates on the 500 error issue yet, but I can certainly answer your other questions.

 

You do not need a paid subscription to leverage the Webhooks API. If an app has webhook subscriptions set up, they will fire in every type of account.

 

Webhook actions in workflows, on the other hand, do require an Enterprise-level subscription (or trial).

 

To reiterate, you can subscribe to changes with the Webhooks API in any account, but you need an Enterprise-level subscription to send outgoing POST requests through workflows.

 

Please let me know if I can clarify further.

Isaac Takushi

Associate Certification Manager
IsaacTakushi
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hi, @narainsagar.

 

On the 500 error issue, we were able to locate the response from your server.

 

It looks like the request handshake is fine as no exceptions are being thrown, but your system is responding with a 500 eror with the following body:

 

{ 
   "status":false,
   "message":"Trying to get property 'objectId' of non-object",
   "statusCode":500
}

Searching this error online, it appears to be a PHP error.

Isaac Takushi

Associate Certification Manager
0 Upvotes
narainsagar
Participant

Webhook test returns 500 error

SOLVE

Hello @IsaacTakushi 

 

Thanks for responding.

 

I have updated my API code a little bit, I am assuming json payload from request and fetching dealId like this below.

 

$payload = json_decode(file_get_contents('php://input'));
$dealId = $payload->{'objectId'};
Here's the postman request:
Screen Shot 2019-09-30 at 2.36.11 PM.png
Request body payload I'm assuming is like this:
{
"eventId": 1,
"subscriptionId": 166771,
"portalId": 6299815,
"occurredAt": 1569835128385,
"subscriptionType": "deal.propertyChange",
"attemptNumber": 0,
"objectId": 123,
"changeSource": "CRM",
"propertyName": "dealstage",
"propertyValue": "sample-value"
}
Can you please have a look now and let me know if this is fine?
 
But, I still get 500 error from webhook subscription Test.
 
Thanks.
0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hi, @narainsagar.

 

Apologies for the delayed response.

 

I was able to replicate the behavior in Postman. The full 500 error is:

 

{
    "status": false,
    "message": "HTTP/1.1 404 Not Found\r\nDate: Tue, 01 Oct 2019 23:19:48 GMT\r\nContent-Type: application/json;charset=utf-8\r\nContent-Length: 101\r\nConnection: keep-alive\r\nSet-Cookie: __cfduid=d970f4a1e9e5f4a8c7d17484d1e3cf7221569971986; expires=Wed, 30-Sep-20 23:19:46 GMT; path=/; domain=.hubapi.com; HttpOnly\r\nX-Trace: 2B165491A88E95D867A0525DF63A6B9E43B737D18F000000000000000000\r\nX-HubSpot-NotFound: true\r\nX-HubSpot-RateLimit-Daily: 500000\r\nX-HubSpot-RateLimit-Daily-Remaining: 499967\r\nX-HubSpot-RateLimit-Interval-Milliseconds: 10000\r\nX-HubSpot-RateLimit-Remaining: 99\r\nX-HubSpot-RateLimit-Max: 100\r\nX-HubSpot-RateLimit-Secondly: 10\r\nX-HubSpot-RateLimit-Secondly-Remaining: 9\r\nVary: Accept-Encoding\r\nAccess-Control-Allow-Credentials: false\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\nExpect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\nServer: cloudflare\r\nCF-RAY: 51f229d59bd8d597-BOM\r\n\r\n{\"status\":\"error\",\"message\":\"Deal does not exist\",\"requestId\":\"9d1f9ad5-da9a-4d12-822a-4e19187f6d6c\"}",
    "statusCode": 500
}

There is a 404 Deal does not exist message from HubSpot inside the message property of your service's 500 response.

 

As you said in your original post:

"This POST method actually fetches the deal information and associated contact information from through the payload->objectId and saves the fetched information into my DB table."


When you test the webhook, your code makes a GET request to the Deals API for a deal with the "objectId": 123 before it returns a response to HubSpot's POST request. The problem is that deal ID 123 is fake — no deal in any HubSpot account has that ID. So, the deals endpoint returns the 404 Deal does not exist error and your code returns a 500 error with HubSpot's response to your GET request as the message.

 

The root of the issue is that your code is trying to look up dummy data for "objectId": 123. Try substituting the ID of a real deal in your test account.

Isaac Takushi

Associate Certification Manager
0 Upvotes
narainsagar
Participant

Webhook test returns 500 error

SOLVE

Hello Isaac,

 

Thanks for responding back.

 

Yes - I've tested Postman with actual Testing dealId and it gives success 200 response as shown in the screenshot below:

Screen Shot 2019-10-03 at 4.44.16 PM.png

 

Also; I have created some dummy deals in my Hubspot Testing account having Deal IDs as below (i.e., marked as BOLD):

 

1046280606 (Test Deal 1)

1046986853 (Test Deal 2)

1047019119 (Test deal3)

1047138608 (Test Fariha)

 

Since it now works with Postman and everything seems to be good. But still it doesn't seems to work with APP webhook subscription.

 

FYI. I've disabled my webhook workflow action in Testing account and Just have webhook subscription created in the APP as shown below:

Screen Shot 2019-10-03 at 4.58.54 PM.pngScreen Shot 2019-10-03 at 4.59.13 PM.png

 

As it seems the webhook subscription will trigger whenever Deal's dealstage property changes.

 

Right now, I have the Testing account API KEY enabled on my server to communicate with hubspot. I don't know why it still not working when I create deals and change dealstage.

 

Could you please give your thoughts on this,

 

Thanks for your consistent co-operation and support.

 

Cheers,

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Webhook test returns 500 error

SOLVE

Hi, @narainsagar.

 

Sorry for the spam/abuse trouble. I've found that this platform tends to flag posts with either large or many code blocks and/or multiple screenshots, even if they're not malicious. It looks like one of my colleagues restored your posts, so we can continue speaking here.

 

I'm glad to see that you got the tests to work in Postman!

 

In order for your application to detect dealstage property changes and send your webhook URL a notification, your app must be connected to your developer test account. I can see that your app with an ID ending in 0930 is not connected to any HubSpot account at this time.

 

You can connect your app to an account through this OAuth flow.

Isaac Takushi

Associate Certification Manager
narainsagar
Participant

Webhook test returns 500 error

SOLVE

Alright @IsaacTakushi  Thanks, I'll implement this OAuth flow and will let you know if I still get any issues.

 

Thanks for your help, I'm accepting your post reply as solution. 

narainsagar
Participant

Webhook test returns 500 error

SOLVE

Hello Isaac,

 

Thanks for the response.

 

Yes that sample deal is 123 is fake. I have created some deals in my testing account having deal IDs are below:

 

1046280606 (Deal name: Test deal 1)

1046986853 (Deal name: Test deal 2)

1047019119 (Deal name: Test deal 3)

1047138608 (Deal name: Test Fariha)

 

Also, here's the working Postman below (i.e., showing 200 success response):

Screen Shot 2019-10-03 at 4.44.16 PM.png

 

So, I have disabled the workflow trigger action in my testing account AND have create a subscription in the developer APP. But when I change deal property it actually doesn't seems to trigger my webhook. I don't know whats the issue but am unable to find why and how the webhook trigger will work?

 

FYI: I have testing account API_KEY enabled on my server right now, when it will work then I'll switch it to real account API KEY.

 

Moreover; Here're the screenshots of my webhook configs & setting etc.

Screen Shot 2019-10-03 at 4.58.54 PM.pngScreen Shot 2019-10-03 at 4.59.13 PM.png

 

Please give your thoughts.

 

Thanks for your consistent co-operation and support.

 

Cheers,

0 Upvotes