We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Nov 2, 2022 3:31 PM
Hello
It seems like the serverless functions that power CRM Cards time out after 2 seconds. This is troubling as most calls to outside endpoints can take more than 2 seconds to initiate ask and return.
Even more troubling and frankly embarrasing, HubSpot can't even seem to handle its own examples being uploaded. I tried to install this example:
https://github.com/HubSpot/ui-extensions-examples/tree/main/simple-form
And constantly got the following errors:
The serverless function 'crm-card' failed to execute: 2022-11-02T16:29:21.260Z 034b1579-846b-4018-bb3c-545c54751f5e Task timed out after 2.03 seconds.
2022-11-02T16:29:21.260Z 034b1579-846b-4018-bb3c-545c54751f5e Task timed out after 2.03 seconds
So I think there's something inherently wrong with either the time limit being too conservative, or the way HubSpot is fetching and attempting to render these cards to the point where even a basic example isn't loading.
Nov 8, 2022 1:26 PM
HI @TL531
const {PdfReader} = require('pdfreader');
pdf2json
which uses pdfparser
which uses fs
Nov 8, 2022 2:00 PM - edited Nov 8, 2022 2:01 PM
I think that you might be right about the fs module being the issue, I've imported it and used it many many times, and while you can import it and read files just fine, you obviously can't write out to the read only file system.
Nov 9, 2022 1:26 PM
So investigated further. The 5s timeout increase did solve the timeout problem, but there was still an syntax error under the hood where it was failing if you used node12.
I wasn't sure if you or anyone was getting synax errors, but I did notice that in some of our own test projects. We've since updated all https://github.com/HubSpot/ui-extensions-examples examples to use node16, so as long as you're pulling in the latest examples, you should be good now.
"runtime": "nodejs16.x",
Nov 9, 2022 1:28 PM
Sick, thanks for investigating
Nov 3, 2022 5:49 PM - edited Nov 3, 2022 5:51 PM
Hi all. We just bumped up the timeout limit to 5 seconds. You'll need to rebuild/deploy again to pick up the changes as the timeout limits for our serverless are set at build time.
This was mostly to be in line with the default timeout of our Public App CRM Card data fetch URLs: https://developers.hubspot.com/docs/api/crm/extensions/custom-cards
Let me know if you still have issues.
Nov 3, 2022 6:48 PM - edited Nov 4, 2022 4:26 PM
Nov 3, 2022 6:22 PM
Excellent, thank you.
Nov 3, 2022 1:08 PM
HI @TL531. I can understand how this would be an issue. This is a beta and we're still trying to find the right balance between the developer and customer experience, while making sure our CRM Records load in a reasonable amount of time. I'm going to bring up with my team and come up with the best next steps here.
In the meantime, do you have examples of which API calls your making and how many in a serverless function? That should help us determine the best limits to put in place for the future.
Nov 3, 2022 6:24 PM
So I wasn't even hitting any outside APIs; I was trying to run just the examples HubSpot provides (in this case, one that interacts with a form function) and that was timing out.
I think ideally if we could get 10 seconds for these that would work best, because most outside endpoints terminate in 5 seconds if no response given.
Nov 3, 2022 7:25 PM
@TL531 wrote:So I wasn't even hitting any outside APIs; I was trying to run just the examples HubSpot provides (in this case, one that interacts with a form function) and that was timing out.
That ideally shouldn't happen, so I will take it to the team for more investigation. My understanding was that you were hitting an outside endpoint by modifying the code sample. So, Thanks for clarifying.
Nov 2, 2022 4:43 PM
Totally agree with Thomas on this one, is there any inherent reason why this isn't 10 seconds like the normal functions, besides client side load times (which has always been the job of the developer to keep efficient)? If we were able to trigger crm card functions via webhooks we could easily build workarounds for this.
Nov 3, 2022 1:06 PM
Nov 3, 2022 1:23 PM
No, I'm talking about the card serverless functions that are not expose by a public endpoint.