transloadit/uppy · error

res.sendStatus(501)

Error message

res.sendStatus(501)

What it means

verifyToken returns HTTP 501 (Not Implemented) for non-OAuth providers when the provider has no configured key/credentials. Companion cannot load a static token for the provider, so the feature is unavailable on this server.

Source

Thrown at packages/@uppy/companion/src/server/middlewares.ts:138

    return
  }

  // for non auth providers, we just load the static key from options
  if (!isOAuthProviderReq(req)) {
    const { providerOptions } = req.companion.options
    const providerName = req.params['providerName']
    const providerOption =
      typeof providerName === 'string'
        ? providerOptions?.[providerName]
        : undefined
    const key = providerOption?.key
    if (!key) {
      logger.info(
        `unconfigured credentials for ${providerName}`,
        'non.oauth.token.load.unset',
        req.id,
      )
      res.sendStatus(501)
      return
    }

    req.companion.providerUserSession = {
      accessToken: key,
    }
    next()
  }
}

// does not fail if token is invalid
export const gentleVerifyToken: RequestHandler = (req, res, next) => {
  const providerName = req.params['providerName']
  if (typeof providerName !== 'string' || providerName.length === 0) {
    next()
    return
  }
  const { secret } = req.companion.options

View on GitHub (pinned to 5d4dedd02a)

Solutions

  1. Configure the provider's key/secret in companionOptions.providerOptions
  2. Check the relevant environment variables are set on the server
  3. Restart Companion after adding credentials

Example fix

// before
providerOptions: { unsplash: {} }
// after
providerOptions: { unsplash: { key: process.env.UNSPLASH_KEY } }
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.UNSPLASH_KEY) throw new Error('Provider key missing — search unavailable')

Prevention

When it happens

Trigger: Using a non-OAuth (search) provider like Unsplash where the provider's key is not set in companionOptions.providerOptions, then hitting a token-verified route.

Common situations: Missing env var for provider key in production, providerOptions not passed when creating the Companion app, config regression after refactor.

Related errors


AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28). Data as JSON: /api/errors/9073dfd1b907252f. Report an issue: GitHub.