Closed justinsoong closed 3 years ago
Hi @justinsoong! Thanks for reaching out. There is no event that fires upon initialization unfortunately. Could you provide any code samples that would help us debug in addition to the Braze Web SDK version that you're using?
@wesleyorbin we're using v2, not many code snippets but we're loading segment via google tag manager (https://github.com/segmentio/analytics.js-integrations/blob/master/integrations/appboy/lib/index.js) this is loaded with the highest order in priority, followed by standard braze calls in lower order priority in GTM
This is happening more frequently because we can't identify when the appboy sdk is fully initialised as the segment initialisation of braze requires a network call to fetch the it's third party script loading configuration, which is likely the reason why this race condition is happening
Hi @justinsoong Can you please try using the v3.1 option in Segment? That SDK version contains an updated integration snippet which likely will help with the race condition you're describing.
If you still experience it on the v3.1 version, can you please raise a support ticket and our team can help dig into your specific website code and implementation?
Thank you @davidbielik are there any breaking changes, but I guess you'd point me to some docs if there were
Hi @justinsoong yes, you can view those here, but high level changes are:
baseUrl
is now required which you'd enter in Segment (if you're not already)appboy.ab
and InAppMessage.Button
will need to be updated It should be a quick upgrade, but please review those docs in case you have custom javascript in your integration. Happy to help answer other questions as you upgrade!
@davidbielik we're still observing this in 3.1 albeit seems lesser based on our exception reporting
Hi @justinsoong thanks for confirming. Can you please open a support ticket (support@braze.com) to help dive in to your website's specific code and environment?
If you can please include more details around where else in your code are you referencing window.appboy
outside of Segment, and other relevant code examples of when/where/how you're calling Braze methods, that'll be helpful.
@justinsoong We just released v3.3.0, which removes the loading snippet code from the npm
package. This should fix any race conditions associated with your integration. I'm going to close out the issue for now, but if you continue to experience issues, feel free to re-open or contact our support team.
This seems to be the only place that is tracking this error.
current setup... Using Segment with Braze destination enabled and the following settings:
There is currently no reference to window.analytics
or window.appboy
anywhere in the app however, as soon as the site loads:
Unhandled Runtime Error
Error: Appboy must be initialized before calling methods.
Call Stack
e
https://js.appboycdn.com/web-sdk/3.1/appboy.min.js (228:244)
Te
https://js.appboycdn.com/web-sdk/3.1/appboy.min.js (236:133)
$f
https://js.appboycdn.com/web-sdk/3.1/appboy.min.js (248:444)
<unknown>
https://js.appboycdn.com/web-sdk/3.1/appboy.min.js (262:102)
<unknown>
https://js.appboycdn.com/web-sdk/3.1/appboy.min.js (263:4)
There does not seem to be a way to update the sdk to 3.3 in this interface, are there any other options?
Hi @studiobrain can you please raise a ticket with our support team to help investigate specifics of your case?
Enable Logging
option in Segmentimport appboy from "@braze/web-sdk"
)Hi! We're having the same error:
We're loading the SDK via Segment destination config as device mode. I can only select up to version 3.1 in segment's interface.
Hi @gonbaum. We are working with Segment to upgrade the SDK version in their interface. We'll update you here when that has been completed.
Hi @gonbaum @studiobrain @justinsoong our new Segment Braze Actions destination is now available which should let you upgrade to version 3.5 of our SDK.
https://segment.com/docs/connections/destinations/catalog/braze-web-device-mode-actions/
@davidbielik - I'm hitting the same issue with a Tealium IQ integration rather than Segment, using web sdk 4.0.6. Is there still no way to identify when the Braze agent has been initialized? No flag or event?
EDIT: feeling a bit dumb here - waiting for document.readyState === 'complete'
accomplishes what I need 😓 , as I just need the initialisation script from tealium to load first. Weirdly I think I haven't had to use that since jquery's .ready()
🤔
EDIT 2: I spoke to soon, this is still an issue :(
Related to https://github.com/Appboy/appboy-web-sdk/issues/63
We use segment to initialise appboy, and are finding a small flurry of Appboy must be initialized before calling errors
Is there an event we can listen to to fire our appboy functions on initialisation complete?
Thanks