Tealium Functions timing out when inserting via the collect endpoint

Silver Contributor
Silver Contributor

I'm trying to make an HTTP call via a Tealium function to return some additional data from hubspot on visitors and then make a second call to the collect endpoint to give that data back to tealium but I'm having timout issues during test I'm wondering if anyone has tried this and if you can help me out.

Processed event function is below. On their own the first call to hubspot takes around 375ms and the second to collect takes around 200ms and both complete successfully. I'm wondering if possibly there is a speed difference between test and prod. Tealium Functions have a fixed timeout of 1000ms so we should be well within acceptable limits of execution time.

import { auth, visitor, event } from "tealium";

const hubspotutk = event?.data?.firstparty_tealium_cookies?.hubspotutk;

const url_1 = 'https://api.hubapi.com/contacts/v1/contact/utk/'+hubspotutk+'/profile?hapikey=apikey';

//console.log(ip_address);
console.log("url_1: "+url_1);
(async function() {
    try {
        // get email
        let hs_response = await fetch(url_1),
        hs_data = await hs_response.json();
        //console.log(JSON.stringify(hs_data));

        var hubspot_email= hs_data?.properties?.email?.value;
        console.log("hubspot_email: "+hubspot_email);

        // Send hubspot_email back into collect endpoint
        const url_2='https://collect.tealiumiq.com/event?tealium_account=account-name&tealium_profile=profile_name&tealium_datasource=ds_id&tealium_event=event_name&hubspot_email='+hubspot_email;
        console.log("url_2: "+url_2);
       
await fetch(encodeURI(url_2)); } catch(e) { console.error(e); return false; } })();

 

2 REPLIES 2

Tealium Functions timing out when inserting via the collect endpoint

Silver Contributor
Silver Contributor
As a quick update, when we look at the above in trace, we're getting a error
TypeError: Connection refused (Connection refused)

Which I take to mean that collect is refusing the connection via the fiunction call, although works perfectly when requested via postman.

Tealium Functions timing out when inserting via the collect endpoint

Bronze Contributor
Bronze Contributor
Did you ever get this resolved?
Public