FlowiseAI/Flowise · error · Error

Spider API key not set. You can set it as SPIDER_API_KEY in

Error message

Spider API key not set. You can set it as SPIDER_API_KEY in your .env file, or pass it to Spider.

What it means

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.

Source

Thrown at packages/components/nodes/documentloaders/Spider/Spider.ts:30

    mode?: 'crawl' | 'scrape'
    limit?: number
    additionalMetadata?: Record<string, unknown>
    params?: Record<string, unknown>
}

class SpiderLoader extends BaseDocumentLoader {
    private apiKey: string
    private url: string
    private mode: 'crawl' | 'scrape'
    private limit?: number
    private additionalMetadata?: Record<string, unknown>
    private params?: Record<string, unknown>

    constructor(loaderParams: SpiderLoaderParameters) {
        super()
        const { apiKey, url, mode = 'crawl', limit, additionalMetadata, params } = loaderParams
        if (!apiKey) {
            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.')
        }

        this.apiKey = apiKey
        this.url = url
        this.mode = mode
        this.limit = Number(limit)
        this.additionalMetadata = additionalMetadata
        this.params = params
    }

    public async load(): Promise<DocumentInterface[]> {
        const app = new SpiderApp({ apiKey: this.apiKey })
        let spiderDocs: any[]

        if (this.mode === 'scrape') {
            const response = await app.scrapeUrl(this.url, this.params)
            if (!response.success) {
                throw new Error(`Spider: Failed to scrape URL. Error: ${response.error}`)

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Set SPIDER_API_KEY in .env (or the Flowise Spider credential) and restart the process.
  2. Confirm the credential is wired into the Spider node's credential property, not just a plain input.
  3. Read the key at construction with fallback: apiKey: process.env.SPIDER_API_KEY || suppliedKey.
  4. Validate apiKey presence in the node layer before constructing the loader and surface a user-facing message.

Example fix

// before
const loader = new SpiderLoader({ apiKey: inputs.apiKey, url, mode })

// after
const apiKey = inputs.apiKey || process.env.SPIDER_API_KEY
if (!apiKey) throw new Error('Set SPIDER_API_KEY before running this node.')
const loader = new SpiderLoader({ apiKey, url, mode })
Defensive patterns

Strategy: validation

Validate before calling

const apiKey = inputs.apiKey || process.env.SPIDER_API_KEY
if (!apiKey || typeof apiKey !== 'string' || apiKey.trim().length < 10) {
    throw new Error('SPIDER_API_KEY missing or too short. Set it in .env or the credential record.')
}
const loader = new SpiderLoader({ apiKey, url, mode })

Type guard

function hasSpiderKey(params: unknown): params is { apiKey: string } {
    return typeof (params as any)?.apiKey === 'string' && (params as any).apiKey.length > 0
}

Try / catch

try {
    new SpiderLoader({ apiKey, url, mode })
} catch (e: any) {
    if (/Spider API key not set/.test(e.message)) {
        // prompt user to configure credentials
    }
    throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/5c80bb804dab53a8. Report an issue: GitHub.