{"record":{"id":"a8c8a56ddc495836","repo":"DIYgod/RSSHub","slug":"twitter-rss-is-disabled-due-to-the-lack-of-a-href","errorCode":null,"errorMessage":"Twitter RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"Twitter RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/deploy/config#route-specific-configurations\">relevant config</a>","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/twitter/trends.ts","lineNumber":27,"sourceCode":"    categories: ['social-media'],\n    example: '/twitter/trends/23424856',\n    parameters: { woeid: 'Yahoo! Where On Earth ID. default to woeid=1 (World Wide)' },\n    features: {\n        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: 'Trends',\n    maintainers: ['sakamossan'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.twitter || !config.twitter.consumerKey || !config.twitter.consumerSecret) {\n        throw new ConfigNotFoundError('Twitter RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>');\n    }\n    const woeid = ctx.req.param('woeid') ?? 1; // Global information is available by using 1 as the WOEID\n    const client = await getAppClient();\n    const data = await client.v1.get('trends/place.json', { id: woeid });\n    const [{ trends }] = data;\n\n    return {\n        title: `Twitter Trends on ${data[0].locations[0].name}`,\n        link: 'https://x.com/i/trends',\n        item: trends\n            .filter((t) => !t.promoted_content)\n            .map((t) => ({\n                title: t.name,\n                link: t.url,\n                description: t.name + (t.tweet_volume ? ` (${t.tweet_volume})` : ''),\n            })),\n    };\n}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/twitter/trends.ts#L9-L45","documentation":"ConfigNotFoundError thrown by the Twitter Trends route handler when config.twitter is missing or lacks consumerKey/consumerSecret. Unlike the web-api routes (which use auth tokens), the trends route uses the legacy v1.1 API via getAppClient(), which requires OAuth 1.0a application credentials. RSSHub surfaces this as a config error with a link to the deploy docs.","triggerScenarios":"Requesting /twitter/trends/:woeid? on an instance where TWITTER_CONSUMER_KEY or TWITTER_CONSUMER_SECRET are not set. The check is the very first statement of the handler, so any request to the trends route without these env vars fails immediately.","commonSituations":"Instance admin enabled general Twitter routes via auth tokens but did not obtain a Twitter developer app for consumer key/secret; env vars renamed or dropped during deploy; Twitter developer app credentials revoked.","solutions":["Create a Twitter Developer app and obtain API Key + API Key Secret.","Set TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET in the RSSHub environment.","Restart RSSHub.","If you cannot get developer credentials, disable the /twitter/trends route or do not request it."],"exampleFix":"// before\n// TWITTER_CONSUMER_KEY=\n// TWITTER_CONSUMER_SECRET=\n// after\n// TWITTER_CONSUMER_KEY=yourApiKey\n// TWITTER_CONSUMER_SECRET=yourApiSecret","handlingStrategy":"validation","validationCode":"function trendsConfigured(cfg: any): boolean {\n  return Boolean(cfg?.twitter?.consumerKey && cfg?.twitter?.consumerSecret);\n}\nif (!trendsConfigured(config)) { /* hide / disable the /twitter/trends route */ }","typeGuard":null,"tryCatchPattern":"try { await fetchRss('/twitter/trends/1'); }\ncatch (e) {\n  if (/disabled due to the lack/.test(String(e))) { /* skip this feed, credentials missing */ }\n  else throw e;\n}","preventionTips":["Set TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET before exposing the trends route.","Use a dedicated read-only Twitter developer app for these credentials.","Rotate credentials before they expire and restart RSSHub after each change."],"tags":["twitter","config-not-found","trends","oauth","configuration","env"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}