{"record":{"id":"bb2c2c1562d2523d","repo":"FlowiseAI/Flowise","slug":"no-api-key-provided-bb2c2c","errorCode":null,"errorMessage":"No API key provided","messagePattern":"No API key provided","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/Spider/SpiderApp.ts","lineNumber":52,"sourceCode":"interface CrawlResponse {\n    success: boolean\n    data?: SpiderDocument[]\n    error?: string\n}\n\ninterface Params {\n    [key: string]: any\n}\n\nclass SpiderApp {\n    private apiKey: string\n    private apiUrl: string\n\n    constructor({ apiKey = null, apiUrl = null }: SpiderAppConfig) {\n        this.apiKey = apiKey || ''\n        this.apiUrl = apiUrl || 'https://api.spider.cloud/v1'\n        if (!this.apiKey) {\n            throw new Error('No API key provided')\n        }\n    }\n\n    async scrapeUrl(url: string, params: Params | null = null): Promise<ScrapeResponse> {\n        const headers = this.prepareHeaders()\n        const jsonData: Params = { url, limit: 1, ...params }\n\n        try {\n            const response: AxiosResponse = await this.postRequest('crawl', jsonData, headers)\n            if (response.status === 200) {\n                const responseData = response.data\n                if (responseData[0].status) {\n                    return { success: true, data: responseData[0] }\n                } else {\n                    throw new Error(`Failed to scrape URL. Error: ${responseData.error}`)\n                }\n            } else {\n                this.handleError(response, 'scrape URL')","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/Spider/SpiderApp.ts#L34-L70","documentation":"SpiderApp constructor guard. With no apiKey (null/undefined/empty) the client cannot authenticate, so it refuses to construct. SpiderLoader passes its apiKey here; this is the lower-level counterpart of error 183.","triggerScenarios":"Constructing `new SpiderApp({})` or `new SpiderApp({ apiKey: null })` directly, or via SpiderLoader when the key resolves to empty. apiUrl defaults to https://api.spider.cloud/v1 so only the key matters.","commonSituations":"Direct SDK use without reading SPIDER_API_KEY, a credential loader that returns undefined, or tests that instantiate SpiderApp without mocking the key.","solutions":["Always pass apiKey: `Bearer ${process.env.SPIDER_API_KEY}` sourced from env.","Validate the env var at app startup and fail fast with a clear message.","In tests, inject a dummy key or mock SpiderApp entirely."],"exampleFix":"// before\nconst app = new SpiderApp({})\n\n// after\nconst apiKey = process.env.SPIDER_API_KEY\nif (!apiKey) throw new Error('SPIDER_API_KEY env var is required')\nconst app = new SpiderApp({ apiKey })","handlingStrategy":"validation","validationCode":"const apiKey = process.env.SPIDER_API_KEY\nif (!apiKey) throw new Error('SPIDER_API_KEY env var is required')\nconst app = new SpiderApp({ apiKey })","typeGuard":"function isSpiderAppConfig(v: unknown): v is { apiKey: string } {\n    return typeof (v as any)?.apiKey === 'string' && (v as any).apiKey.length > 0\n}","tryCatchPattern":"try {\n    new SpiderApp({ apiKey })\n} catch (e: any) {\n    if (/No API key provided/.test(e.message)) {\n        // redirect to credential setup\n    }\n    throw e\n}","preventionTips":["Never instantiate SpiderApp without first asserting the key is present.","Fail fast on missing env vars at app boot.","Inject a dummy key or mock in tests.","Keep this guard aligned with the SpiderLoader constructor guard."],"tags":["spider","authentication","validation","constructor"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}