{"record":{"id":"5c80bb804dab53a8","repo":"FlowiseAI/Flowise","slug":"spider-api-key-not-set-you-can-set-it-as-spider-a","errorCode":null,"errorMessage":"Spider API key not set. You can set it as SPIDER_API_KEY in your .env file, or pass it to Spider.","messagePattern":"Spider API key not set\\. You can set it as SPIDER_API_KEY in your \\.env file, or pass it to Spider\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/Spider/Spider.ts","lineNumber":30,"sourceCode":"    mode?: 'crawl' | 'scrape'\n    limit?: number\n    additionalMetadata?: Record<string, unknown>\n    params?: Record<string, unknown>\n}\n\nclass SpiderLoader extends BaseDocumentLoader {\n    private apiKey: string\n    private url: string\n    private mode: 'crawl' | 'scrape'\n    private limit?: number\n    private additionalMetadata?: Record<string, unknown>\n    private params?: Record<string, unknown>\n\n    constructor(loaderParams: SpiderLoaderParameters) {\n        super()\n        const { apiKey, url, mode = 'crawl', limit, additionalMetadata, params } = loaderParams\n        if (!apiKey) {\n            throw new Error('Spider API key not set. You can set it as SPIDER_API_KEY in your .env file, or pass it to Spider.')\n        }\n\n        this.apiKey = apiKey\n        this.url = url\n        this.mode = mode\n        this.limit = Number(limit)\n        this.additionalMetadata = additionalMetadata\n        this.params = params\n    }\n\n    public async load(): Promise<DocumentInterface[]> {\n        const app = new SpiderApp({ apiKey: this.apiKey })\n        let spiderDocs: any[]\n\n        if (this.mode === 'scrape') {\n            const response = await app.scrapeUrl(this.url, this.params)\n            if (!response.success) {\n                throw new Error(`Spider: Failed to scrape URL. Error: ${response.error}`)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/Spider/Spider.ts#L12-L48","documentation":"Constructor validation in SpiderLoader (LangChain-style BaseDocumentLoader). If no apiKey is passed through loaderParams the object refuses to build, because every subsequent Spider API call requires a Bearer token.","triggerScenarios":"Instantiating `new SpiderLoader({ apiKey: undefined, ... })` or `new SpiderLoader({ apiKey: '', ... })`, typically because SPIDER_API_KEY was never set in .env, the credential component did not inject it, or the node wiring passes the wrong variable.","commonSituations":"Fresh local setup without .env, missing Flowise credential record for Spider, key stored under a different env var name, or a deploy that strips empty-string env values to undefined.","solutions":["Set SPIDER_API_KEY in .env (or the Flowise Spider credential) and restart the process.","Confirm the credential is wired into the Spider node's credential property, not just a plain input.","Read the key at construction with fallback: apiKey: process.env.SPIDER_API_KEY || suppliedKey.","Validate apiKey presence in the node layer before constructing the loader and surface a user-facing message."],"exampleFix":"// before\nconst loader = new SpiderLoader({ apiKey: inputs.apiKey, url, mode })\n\n// after\nconst apiKey = inputs.apiKey || process.env.SPIDER_API_KEY\nif (!apiKey) throw new Error('Set SPIDER_API_KEY before running this node.')\nconst loader = new SpiderLoader({ apiKey, url, mode })","handlingStrategy":"validation","validationCode":"const apiKey = inputs.apiKey || process.env.SPIDER_API_KEY\nif (!apiKey || typeof apiKey !== 'string' || apiKey.trim().length < 10) {\n    throw new Error('SPIDER_API_KEY missing or too short. Set it in .env or the credential record.')\n}\nconst loader = new SpiderLoader({ apiKey, url, mode })","typeGuard":"function hasSpiderKey(params: unknown): params is { apiKey: string } {\n    return typeof (params as any)?.apiKey === 'string' && (params as any).apiKey.length > 0\n}","tryCatchPattern":"try {\n    new SpiderLoader({ apiKey, url, mode })\n} catch (e: any) {\n    if (/Spider API key not set/.test(e.message)) {\n        // prompt user to configure credentials\n    }\n    throw e\n}","preventionTips":["Centralize credential loading so missing keys fail loudly at startup.","Wire the Flowise credential component, not a plain text input, for the key.","Add an env-var presence check in the node's init hook.","Document the SPIDER_API_KEY env var in the node description."],"tags":["spider","authentication","validation","config"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}