Hey There, we're noticing that the `rudderanalyti...
# support
a
Hey There, we're noticing that the
rudderanalytics.ready()
function is taking FOREVER to fire (like > 10 seconds) whereas the
page()
calls seem to be fired immediately. Any idea why this would be happening?
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
h
before page events do a http call or just fire?
the events are all created before rudder ready but kept in a cache
a
do an http call
i just wrote a function that calls the
rudderanalytics.getAnonymousId()
function every 25 MS and it resolves over 10 seconds before the ready event is fired. guessing it's because it's waiting on the integrations to get done loading
but would be nice if there were different flavors of the ready call so if you only needed certain parts of the API to be available it would be smart enough to resolve sooner
h
can you show your code?
how many integrations have you got
a
Yeah sure thing. This is running in the header of a WebFlow site:
Copy code
<script type="text/javascript">
!function(){var e=window.rudderanalytics=window.rudderanalytics||[];e.methods=["load","page","track","identify","alias","group","ready","reset","getAnonymousId","setAnonymousId","getUserId","getUserTraits","getGroupId","getGroupTraits","startSession","endSession"],e.factory=function(t){return function(){e.push([t].concat(Array.prototype.slice.call(arguments)))}};for(var t=0;t<e.methods.length;t++){var r=e.methods[t];e[r]=e.factory(r)}e.loadJS=function(e,t){var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="{proxied_js_lib_url}";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a)},e.loadJS(),
  e.load("{our_write_key}","{proxied_api_url}", {
    configUrl: "{proxied_config_url}",
    destSDKBaseURL: "{proxied_sdk_url}",
    integrations: {}
  })}();
    // This simply grabs some additional properties from an attribution helper script
    var params = attribution.params().query;
  	rudderanalytics.page(params);
</script>
Further down in the header I was running the following as a test
Copy code
rudderanalytics.ready(() => {
    console.log("All set!");
});
The ready bit takes an eternity to fire whereas the retry logic I'm using with
rudderanalytics.getAnonymousId()
resolves in under 100 ms We have 10 destinations running as part of this JS source. a handful are running in device mode
m
Hi Philip the request ideally should not take so long. But are you sure that it is the rudderanalytics code that is taking so long, I mean is there any other script that is taking long? Also, what SDK version are you using and what device-mode integrations do you have?
a
Yeah, I'm positive. We're still on v1.1 of the SDK (looking into upgrading to the new beta) GA4 Hybrid, Facebook Pixel, Google Ads, PostHog, VWO
h
The ready callback is fired after the SDK fully initializes all its services, and the native destination SDKs also report ready. If the callback is taking longer, then most likely, at least 1 device mode destination is taking longer to get initialized. Do you see any errors on the browser's console? Perhaps you can share your site URL.
a
This has been a long time, but actually running into this again in v2 of the SDK. I believe this behavior is happening when device mode destinations that are included in the config get blocked by add blockers
m
Hi Philip, can you move to the v3 SDK. It is much more stable than it was 6 months ago and should not have such issues.
a
@shy-kite-21035 thanks, will give that a shot. any way to avoid this behavior in v2? we'll have to make this change across several surfaces so a quick fix while we migrate to v3 would be great
m
I don’t think there is a quick fix. Can you share your website?
a
@shy-kite-21035 https://welcome.femgevityhealth.com/onboarding
m
Hi Philip, I checked on the website, and the v1responderUuid request seems to be taking the longest time. Can you check on this?
a
It’s because it’s being blocked by the Rudderstack ready event. It’s an embedded form where we need to pass the anonymous id in as a hidden field and won’t load by design until the ready callback which is the problem. turn on and off an ad blocker and check the difference logged out to the console in timing
m
I did actually try try that, and when using the ad-blocker the page load much slower.
a
yeah exactly. you can see the calls out to the client side libraries get blocked and then things just hang until i'm guessing some timeout and then it becomes ready and loads the form
also seems like a bug that the requests to get the device mode libraries don't use the config URL we are setting
i'm logging lots of things to the console where you can clearly see the error being thrown by the libary
my guess is that there is a 20 second timeout
m
Yeah so the config url is for loading the config for the destinations that you have setup. It is different from the device mode libraries to load. Once the config is loaded the device mode libraries are fetched from their respective end-points
I will raise this to the team again and see what they say.
a
yeah, feels like it should also be overridden in the case you are setting the config URL, otherwise it defeats the whole purpose of proxying your requests. thanks!
m
Hi Philip but can't you create a random uuid as your anonymousId and load the form? Later once the SDK is ready, you can overwrite the Rudderstack anonymousId with the random id you created, in which case the form will not be blocked.
s
With rudderanalytics.setAnonymousid() function
a
no unfortunately, that's not how this embedded react component works. It's from a vendor called FormSort and you have to initialize the form with any values you want to pass in. You can't set them after it's loaded
s
Oh ok. I ll check out formsort
s
👍
a
Upgrading to v3 and seeing this error a lot. This is in a Next.JS app - looks like another user was getting this same thing 5 months ago. Is this something to worry about?
Copy code
RS SDK  CapabilitiesManager:: The "sessionStorage" storage type is unavailable. TypeError: Cannot read properties of undefined (reading 'setItem')
h
@average-monkey-86292 this can be ignored. The SDK determines the capabilities available during load. In this case, session storage is inaccessible. The functionality is not impacted in any way. Also, we've turned this into a warning in the later versions. Please upgrade.
a
@helpful-daybreak-79835 thanks! Will do, I just installed the lib this morning and it gave me
3.0.0-beta.23
will see if there's a later version
@helpful-daybreak-79835 Looks like that is the latest version unless I'm missing something:
h
That's the latest. Apologies, we're going to release this change in the upcoming release (next week).
a
ok cool, thanks for confirming