DIYgod/RSSHub · error · ConfigNotFoundError

Notion RSS is disabled due to the lack of NOTION_TOKEN(<a hr

Error message

Notion RSS is disabled due to the lack of NOTION_TOKEN(<a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>)

What it means

ConfigNotFoundError thrown by the Notion database route when config.notion.key is falsy. The route uses the official @notionhq/client SDK with an auth token (NOTION_TOKEN); without it the SDK cannot call the Notion API, so the route refuses to run and links to the deploy config docs.

Source

Thrown at lib/routes/notion/database.ts:62

    name: 'Database',
    maintainers: ['curly210102'],
    handler,
    description: `There is an optional query parameter called \`properties=\` that can be used to customize field mapping. There are three built-in fields: author, pubTime and link, which can be used to add additional information.

For example, if you have set up three properties in your database - "Publish Time", "Author", and "Original Article Link" - then execute the following JavaScript code to get the result for the properties parameter.

\`\`\`js
encodeURIComponent(JSON.stringify({"pubTime": "Publish Time", "author": "Author", "link": "Original Article Link"}))
\`\`\`

There is an optional query parameter called \`query=\` that can be used to customize the search rules for your database, such as custom sorting and filtering rules.

please refer to the [Notion API documentation](https://developers.notion.com/reference/post-database-query) and execute \`encodeURIComponent(JSON.stringify(custom rules))\` to provide the query parameter.`,
};

async function handler(ctx) {
    if (!config.notion.key) {
        throw new ConfigNotFoundError('Notion RSS is disabled due to the lack of NOTION_TOKEN(<a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>)');
    }

    const databaseId = ctx.req.param('databaseId');
    const notion_api_key = config.notion.key;

    const notion = new Client({
        auth: notion_api_key,
    });

    try {
        // Query database basic info
        const database = (await notion.databases.retrieve({ database_id: databaseId })) as any;
        const title = database.title[0]?.plain_text;
        const description = database.description[0]?.plain_text;
        const link = database.url;
        const image = database.cover?.external.url ?? database.icon?.emoji;

        // List pages under the database

View on GitHub (pinned to bed535e087)

Solutions

  1. Create an internal integration at notion.so/my-integrations, copy the secret, and set NOTION_TOKEN (config.notion.key) in the RSSHub environment.
  2. In Notion, share the target database with the integration (Open database → ••• → Connections → add the integration) — the token alone is not enough.
  3. Restart RSSHub after setting the env var so config is re-read.
  4. Verify with a single database you know is shared with the integration.

Example fix

// before
if (!config.notion.key) {
    throw new ConfigNotFoundError('Notion RSS is disabled ...');
}

// after — set env: export NOTION_TOKEN='secret_xxx' and share the DB with the integration
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.NOTION_TOKEN) {
  console.error('NOTION_TOKEN not set — /notion/database/* will throw ConfigNotFoundError.');
}

Type guard

const isNotionConfigured = (): boolean =>
  Boolean(config.notion && typeof config.notion.key === 'string' && config.notion.key.startsWith('secret_'));

Try / catch

try { await fetch('/notion/database/<id>'); }
catch (e) {
  if (/NOTION_TOKEN/.test(e.message)) { /* operator config issue, no retry */ }
  else throw e;
}

Prevention

When it happens

Trigger: Calling /notion/database/:databaseId without NOTION_TOKEN (config.notion.key) set. The route declares NOTION_TOKEN under features.requireConfig, so this guard is the runtime enforcement.

Common situations: Fresh RSSHub deploy without NOTION_TOKEN; env var cleared during a rebuild; token was revoked in Notion and removed from config; self-hosted instance never configured for Notion.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/c22c4e8738095f02. Report an issue: GitHub.