Meteor 3 - Replacement for WebApp.clientPrograms? (solved)

The Meteor docs for using Helmet include this code:

// add client versions to __meteor_runtime_config__
Object.keys(WebApp.clientPrograms).forEach(arch => {
  __meteor_runtime_config__.versions[arch] = {
    version: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].version(),
    versionRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionRefreshable(),
    versionNonRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionNonRefreshable(),
    // comment the following line if you use Meteor < 2.0
    versionReplaceable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionReplaceable()
  }
})

Running this in Meteor v3 throws this error:

WebApp.clientPrograms[arch].version is not a function

Are there docs yet on how to correct this?

It looks like version, versionRefreshable, etc., just aren’t functions anymore. They’re just strings. So this seems to work:

// add client versions to __meteor_runtime_config__
    Object.keys(WebApp.clientPrograms).forEach(arch => {
        __meteor_runtime_config__.versions[arch] = {
            version: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].version,
            versionRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionRefreshable,
            versionNonRefreshable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionNonRefreshable,
            // comment the following line if you use Meteor < 2.0
            versionReplaceable: Autoupdate.autoupdateVersion || WebApp.clientPrograms[arch].versionReplaceable
        }
    })

Okay, that was easy.

First time reading that page… and that was one complex guide

1 Like