{"record":{"id":"0a3ea015fb772203","repo":"DIYgod/RSSHub","slug":"qweather-rss-is-disabled-due-to-the-lack-of-a-hre-0a3ea0","errorCode":null,"errorMessage":"QWeather RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/zh/install/config#%E5%92%8C%E9%A3%8E%E5%A4%A9%E6%B0%94\">relevant config</a>","messagePattern":"QWeather RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/zh/install/config#%E5%92%8C%E9%A3%8E%E5%A4%A9%E6%B0%94\">relevant config</a>","errorType":"error_code","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/qweather/now.ts","lineNumber":40,"sourceCode":"            {\n                name: 'HEFENG_API_HOST',\n                description: 'This is required after 2026/01/01: https://blog.qweather.com/announce/public-api-domain-change-to-api-host/',\n            },\n        ],\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '实时天气',\n    maintainers: ['Rein-Ou'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.hefeng.key || !config.hefeng.apiHost) {\n        throw new ConfigNotFoundError('QWeather RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/zh/install/config#%E5%92%8C%E9%A3%8E%E5%A4%A9%E6%B0%94\">relevant config</a>');\n    }\n    const NOW_WEATHER_API = `https://${config.hefeng.apiHost}/v7/weather/now`;\n    const CIRY_LOOKUP_API = `https://${config.hefeng.apiHost}/geo/v2/city/lookup`;\n\n    const id = await cache.tryGet('qweather:' + ctx.req.param('location') + ':id', async () => {\n        const response = await got(`${CIRY_LOOKUP_API}?location=${ctx.req.param('location')}&key=${config.hefeng.key}`);\n        const data = response.data.location.map((loc) => loc);\n        return data[0].id;\n    });\n    const requestUrl = `${NOW_WEATHER_API}?key=${config.hefeng.key}&location=${id}`;\n    const responseData = await cache.tryGet(\n        'qweather:' + ctx.req.param('location') + ':now',\n        async () => {\n            const response = await got(requestUrl);\n            return response.data;\n        },\n        3600, // second\n        false","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/qweather/now.ts#L22-L58","documentation":"The QWeather `now` (real-time) route gates on the same pair of config values as the 3-day route: `config.hefeng.key` and `config.hefeng.apiHost`. If either is absent the handler throws `ConfigNotFoundError` before any network call. Without the key the QWeather Now endpoint would reject every request.","triggerScenarios":"Same as 3days: a route request to /qweather/now/:location on an instance where Hefeng config is incomplete.","commonSituations":"Instance upgraded without re-setting env vars; key rotated but only the new one (not apiHost) was re-added; Docker image run without `-e HEFENG_KEY=...`.","solutions":["Provide both `HEFENG_KEY` and `HEFENG_APIHOST` in the RSSHub configuration and restart.","Confirm the key is valid by calling the QWeather API directly with curl; an invalid key surfaces as a 401/403 from the upstream rather than this error.","Use a documented apiHost (`devapi.qweather.com` for free tier, `api.qweather.com` for paid)."],"exampleFix":"// before\nHEFENG_KEY=\nHEFENG_APIHOST=\n\n// after\nHEFENG_KEY=<valid key>\nHEFENG_APIHOST=devapi.qweather.com","handlingStrategy":"validation","validationCode":"if (!config.hefeng?.key || !config.hefeng?.apiHost) {\n    return ctx.body('QWeather now route requires HEFENG_KEY and HEFENG_APIHOST.', 503);\n}","typeGuard":"const hasHefengConfig = (c: typeof config): boolean => Boolean(c.hefeng?.key && c.hefeng?.apiHost);","tryCatchPattern":"try { /* handler */ } catch (e) { if (e instanceof ConfigNotFoundError) { /* hint */ } throw e; }","preventionTips":["Share a single Hefeng config check across all qweather routes via a helper.","Restart RSSHub after env edits.","Validate the key with a direct curl to the city-lookup endpoint."],"tags":["config-missing","env-vars","weather"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}