{"record":{"id":"9073dfd1b907252f","repo":"transloadit/uppy","slug":"res-sendstatus-501-9073df","errorCode":null,"errorMessage":"res.sendStatus(501)","messagePattern":"res\\.sendStatus\\(501\\)","errorType":"http","errorClass":null,"httpStatus":501,"severity":"error","filePath":"packages/@uppy/companion/src/server/middlewares.ts","lineNumber":138,"sourceCode":"    return\n  }\n\n  // for non auth providers, we just load the static key from options\n  if (!isOAuthProviderReq(req)) {\n    const { providerOptions } = req.companion.options\n    const providerName = req.params['providerName']\n    const providerOption =\n      typeof providerName === 'string'\n        ? providerOptions?.[providerName]\n        : undefined\n    const key = providerOption?.key\n    if (!key) {\n      logger.info(\n        `unconfigured credentials for ${providerName}`,\n        'non.oauth.token.load.unset',\n        req.id,\n      )\n      res.sendStatus(501)\n      return\n    }\n\n    req.companion.providerUserSession = {\n      accessToken: key,\n    }\n    next()\n  }\n}\n\n// does not fail if token is invalid\nexport const gentleVerifyToken: RequestHandler = (req, res, next) => {\n  const providerName = req.params['providerName']\n  if (typeof providerName !== 'string' || providerName.length === 0) {\n    next()\n    return\n  }\n  const { secret } = req.companion.options","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/companion/src/server/middlewares.ts#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"Missing env var for provider key in production, providerOptions not passed when creating the Companion app, config regression after refactor.","solutions":["Configure the provider's key/secret in companionOptions.providerOptions","Check the relevant environment variables are set on the server","Restart Companion after adding credentials"],"exampleFix":"// before\nproviderOptions: { unsplash: {} }\n// after\nproviderOptions: { unsplash: { key: process.env.UNSPLASH_KEY } }","handlingStrategy":"validation","validationCode":"if (!process.env.UNSPLASH_KEY) throw new Error('Provider key missing — search unavailable')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast at startup if required provider credentials are missing","Hide UI for unconfigured providers"],"tags":["companion","auth","http-501","credentials"],"backgroundTag":"missing-credentials","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}