{"record":{"id":"63bb656af433c8e6","repo":"DIYgod/RSSHub","slug":"discord-rss-is-disabled-due-to-the-lack-of-a-href","errorCode":null,"errorMessage":"Discord RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"Discord 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/discord/channel.ts","lineNumber":41,"sourceCode":"        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['discord.com/channels/:guildId/:channelId/:messageID', 'discord.com/channels/:guildId/:channelId'],\n        },\n    ],\n    name: 'Channel Messages',\n    maintainers: ['TonyRL'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.discord || !config.discord.authorization) {\n        throw new ConfigNotFoundError('Discord 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 { authorization } = config.discord;\n    const channelId = ctx.req.param('channelId');\n\n    const channelInfo = await getChannel(channelId, authorization);\n    const messagesRaw = await getChannelMessages(channelId, authorization, ctx.req.query('limit') ?? 100);\n    const { name: channelName, topic: channelTopic, guild_id: guildId } = channelInfo as APITextChannel;\n\n    const guildInfo = await getGuild(guildId, authorization);\n    const { name: guildName, icon: guidIcon } = guildInfo;\n\n    const messages = messagesRaw.map((message): DataItem => ({\n        title: message.content.split('\\n', 1)[0],\n        description: renderDescription({ message, guildInfo }),\n        author: `${message.author.global_name ?? message.author.username}(${message.author.username})`,\n        pubDate: parseDate(message.timestamp),\n        updated: message.edited_timestamp ? parseDate(message.edited_timestamp) : undefined,\n        category: `#${channelName}`,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/discord/channel.ts#L23-L59","documentation":"The Discord channel messages route requires server-side configuration of a Discord authorization token (config.discord.authorization). This token is a self-bot or user token used to read channel messages via Discord's API. If config.discord is not set or lacks the authorization field, a ConfigNotFoundError is thrown with a link to the configuration documentation.","triggerScenarios":"The handler checks config.discord and config.discord.authorization. If either is falsy, the route cannot authenticate to Discord's API and immediately throws. This is a deployment configuration issue, not a runtime or user-input error.","commonSituations":"Self-hosted RSSHub instance without DISCORD_AUTHORIZATION environment variable set; the env var was named incorrectly (e.g., DISCORD_TOKEN instead of DISCORD_AUTHORIZATION); the Discord account token expired or was revoked; the config file is malformed and config.discord is undefined.","solutions":["Set the DISCORD_AUTHORIZATION environment variable in your RSSHub deployment with a valid Discord token.","Refer to https://docs.rsshub.app/deploy/config#route-specific-configurations for the exact variable name.","Obtain a Discord authorization token from your browser's Network tab (Authorization header in Discord web requests).","Restart RSSHub after setting the environment variable to ensure it is picked up."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check config at deployment time\nif (!process.env.DISCORD_AUTHORIZATION) {\n    console.warn('DISCORD_AUTHORIZATION is not set — Discord routes will not work');\n}\n// Runtime guard in handler\nif (!config.discord?.authorization) {\n    throw new ConfigNotFoundError('Discord RSS is disabled — set DISCORD_AUTHORIZATION');\n}","typeGuard":"function hasDiscordConfig(cfg: any): cfg is { discord: { authorization: string } } {\n    return cfg?.discord?.authorization != null && typeof cfg.discord.authorization === 'string' && cfg.discord.authorization.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Set DISCORD_AUTHORIZATION in your deployment environment before enabling Discord routes.","Verify the token is valid by testing a Discord API call directly.","Regularly check token validity — Discord user tokens can be revoked.","Document required environment variables in your deployment README."],"tags":["discord","configuration","authentication","config-not-found","self-hosted"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}