Skip to content
← Back to activity

Public problem

subscribeToContentCardsUpdates not firing in Next.js (Braze web SDK)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

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.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

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