rfcx / rfcx-api

Core, Media/Assets and MQTT APIs
https://api.rfcx.org/docs/
Apache License 2.0
0 stars 0 forks source link

Core create `stream` without `external_id` #628

Closed Tooseriuz closed 5 months ago

Tooseriuz commented 5 months ago

Zhenya is suspecting that when the arbimon consumer was down. it makes Core API POST /streams can create successfully

  if (arbimonService.isEnabled && options.requestSource !== 'arbimon') {
    try {
      const arbimonSite = { ...fullStream, country_code: fullStream.countryCode }
      const externalSite = await arbimonService.createSite(arbimonSite, options.idToken)
      fullStream.externalId = externalSite.site_id
    } catch (error) {
      console.error(`Error creating site in Arbimon (stream: ${fullStream.id})`)
      throw new Error()
    }
  }

should we check site_id and throw an Error if undefined ?

      if (!externalSite.site_id) {
        throw new Error('site_id is missing in stream creation response')
      }