DIYgod/RSSHub · error · ConfigNotFoundError
缺少 Medium 用户 ${user} 登录后的 Cookie 值
Error message
缺少 Medium 用户 ${user} 登录后的 Cookie 值 What it means
ConfigNotFoundError thrown by the Medium 'following' route when no cookie is configured for the given user in config.medium.cookies[user]. Personalized following feeds require an authenticated Medium session cookie, so self-hosting with a valid login cookie is mandatory.
Source
Thrown at lib/routes/medium/following.ts:39
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: 'Personalized Recommendations - Following',
maintainers: ['ImSingee'],
handler,
description: `::: warning
Personalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.
:::`,
};
async function handler(ctx) {
const user = ctx.req.param('user');
const cookie = config.medium.cookies[user];
if (cookie === undefined) {
throw new ConfigNotFoundError(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`);
}
const posts = await getFollowingFeedQuery(user, cookie);
ctx.set('json', posts);
if (!posts) {
// login failed
throw new ConfigNotFoundError(`Medium 用户 ${user} 的 Cookie 无效或已过期`);
}
const urls = posts.items.map((data) => data.post.mediumUrl);
const parsedArticles = await Promise.all(urls.map((url) => parseArticle(ctx, url)));
return {
title: `${user} Medium Following`,
link: 'https://medium.com/?feed=following',
item: parsedArticles,View on GitHub (pinned to bed535e087)
Solutions
- Set the MEDIUM_COOKIES environment variable or config.medium.cookies entry keyed by the exact Medium username (without @).
- After logging into medium.com in a browser, copy the 'sid' / 'cf_obc' cookie values into config.
- Restart RSSHub after editing config so the new cookies load.
- Confirm the cookie key string matches the :user path segment character-for-character.
Example fix
// config (env) // before: MEDIUM_COOKIES not set // after (env) MEDIUM_COOKIES=johndoe=sid%3A1%2C...
Defensive patterns
Strategy: validation
Validate before calling
const cookie = config.medium.cookies?.[user];
if (!cookie) {
throw new ConfigNotFoundError(`No Medium cookie for ${user}. Set MEDIUM_COOKIES env var.`);
} Type guard
function hasMediumCookie(user: string): boolean {
return Boolean(config.medium.cookies?.[user]);
} Prevention
- Document MEDIUM_COOKIES format in deployment notes.
- Key cookies by exact username without @.
- Self-host and load-test the cookie before subscribing.
When it happens
Trigger: config.medium.cookies[user] is undefined — the user has not added a Cookie entry for this Medium handle in the RSSHub configuration (environment variable MIYOUSHE-like env: MEDIUM_COOKIES or config file).
Common situations: Fresh self-hosted RSSHub install without configuring MEDIUM_COOKIES; typo in the user key (cookies keyed by a different handle than the one in the URL); using the public RSSHub instance which intentionally does not set per-user cookies.
Related errors
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- Medium 用户 ${user} 的 Cookie 无效或已过期
- Medium 用户 ${user} 的 Cookie 无效或已过期
- 无权访问 id 为 ${catalogId} 的 List(可能是未设置 Cookie 或 Cookie 已过期)
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/df002c0ac74ddac8.
Report an issue: GitHub.