Music Kit initialisation, Uncaught TypeError: Cannot read properties of undefined (reading 'node')

I'm trying to load Music Kit on the server with solid js. I can confirm that my implementation has been sufficient to return authentication tokens and for MusicKit.isAuthorized to return true. My issue is that if I reload the page, it only succeeds intermittently (perhaps 25% of the time?). My question is - what is wrong with my implementation? Removing the async keyword ensures it loads every time but playing and queuing music no longer works. I'm currently assuming this is an SSR issue but the docs haven't explicitly specified this isn't possible.

I have the following boilerplate:


export default createHandler(
  () => (
    <StartServer
      document={({ assets, children, scripts }) => {
        return (
          <html lang="en">
            <head>
              <meta name="apple-music-developer-token" content={authResult.token} />
              <meta name="apple-music-app-name" content="app name" />
              <meta name="apple-music-app-build" content="1978.4.1" />
              {assets}
              <script
                src="https://js-cdn.music.apple.com/musickit/v3/musickit.js"
                async
              />
            </head>
            <body>
              <div id="app">{children}</div>
              {scripts}
            </body>
          </html>
        )
      }}
    />
  ))

When I first load my app, I'll encounter:

musickit.js:13 Uncaught TypeError: Cannot read properties of undefined (reading 'node')
    at musickit.js:13:10194
    at musickit.js:13:140
    at musickit.js:13:209

The intermittence signals an issue relating to the async keyword. An expansion on this issue can be found here.

Music Kit initialisation, Uncaught TypeError: Cannot read properties of undefined (reading 'node')
 
 
Q