On Next.js with Braze Web SDK 4.1.0 installed via npm, subscribeToContentCardsUpdates((cards) => ...) never fires after initialize() succeeds. The reporter expected existing Content Cards to appear on login and new cards to arrive while logged in. The SDK was initialized with manageServiceWorkerExternally: true.
subscribeToContentCardsUpdates not firing in Next.js (Braze web SDK)
- Content Cardsservice
- Braze web SDKlibrary
- Next.jsframework
- Brazeorganization
- braze.logCardImpressionsservice
- +3 more
Content Cards are not pushed instantly at session start; the card takes a few seconds to be created server-side, so the subscriber fires only on subsequent updates. To get the behavior you want: call requestContentCardsRefresh() right after the user logs in to fetch the existing cards, then use subscribeToContentCardsUpdates() for cards that arrive while the session is active. For marking cards as viewed/impressed in a custom UI, call braze.logCardImpressions(cards) per Braze's custom-UI guide. This is the documented usage pattern per Braze support. Source: https://github.com/braze-inc/braze-web-sdk/issues/128
Source: https://github.com/braze-inc/braze-web-sdk/issues/128