FlowiseAI/Flowise · error · Error

API key is required for cloud connection

Error message

API key is required for cloud connection

What it means

createWeaviateClient() requires an apiKey for the cloud path because weaviate.connectToWeaviateCloud authenticates exclusively via ApiKey credentials. The guard fails fast before touching the SDK when weaviateConnectionType === 'cloud' and apiKey is falsy.

Source

Thrown at packages/components/nodes/vectorstores/Weaviate/Weaviate.ts:43

        const port = parseInt(maybePart, 10)
        if (!isNaN(port) && String(port) === maybePart) {
            return { host: host.substring(0, lastColon), port }
        }
    }
    return { host }
}

async function createWeaviateClient(
    weaviateConnectionType: string,
    rawHost: string,
    httpSecure?: boolean,
    rawGrpcHost?: string,
    grpcSecure?: boolean,
    apiKey?: string
): Promise<Awaited<ReturnType<typeof weaviate.connectToCustom>>> {
    if (weaviateConnectionType === 'cloud') {
        if (!apiKey) {
            throw new Error('API key is required for cloud connection')
        }
        return weaviate.connectToWeaviateCloud(rawHost, {
            authCredentials: new weaviate.ApiKey(apiKey)
        })
    }

    const { host: extractedHttpHost, port: extractedHttpPort } = parseHostPort(rawHost)
    const { host: extractedGrpcHost, port: extractedGrpcPort } = parseHostPort(rawGrpcHost ?? '')

    if (weaviateConnectionType === 'local') {
        const options: Parameters<typeof weaviate.connectToLocal>[0] = {
            host: extractedHttpHost,
            port: extractedHttpPort,
            grpcPort: extractedGrpcPort,
            authCredentials: apiKey ? new weaviate.ApiKey(apiKey) : undefined
        }
        return weaviate.connectToLocal(options)
    }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Open the Weaviate node credential and set the apiKey for the WCS cluster.
  2. Confirm nodeData.credential references the correct credential id (otherwise getCredentialData returns empty and apiKey resolves undefined).
  3. If targeting self-hosted Weaviate, switch weaviateConnectionType to 'local' and provide weaviateHost / weaviateGrpcHost instead.

Example fix

// before
createWeaviateClient('cloud', clusterUrl, undefined, undefined, undefined, undefined)
// throws: API key is required for cloud connection

// after
createWeaviateClient('cloud', clusterUrl, undefined, undefined, undefined, process.env.WCS_API_KEY)
Defensive patterns

Strategy: validation

Validate before calling

// Validate cloud config before calling createWeaviateClient
function ensureWeaviateCloudConfig(connType, apiKey) {
    if (connType === 'cloud' && !apiKey) {
        throw new Error('Cannot use weaviateConnectionType=cloud without an apiKey credential')
    }
}

Type guard

function isWeaviateCloudConfig(c) {
    return c.weaviateConnectionType === 'cloud' && typeof c.apiKey === 'string' && c.apiKey.length > 0
}

Try / catch

try {
    const client = await createWeaviateClient(connType, host, httpSecure, grpcHost, grpcSecure, apiKey)
} catch (e) {
    if (/API key is required for cloud connection/.test(e.message)) {
        // prompt the user to attach a Weaviate credential with apiKey
    }
    throw e
}

Prevention

When it happens

Trigger: Node configured with weaviateConnectionType='cloud' but the apiKey parameter passed into createWeaviateClient is undefined/empty (credential not wired, credential field blank, or getCredentialParam returned nothing).

Common situations: Weaviate Cloud Service (WCS) deployment selected but the credential component is not attached to the node; the apiKey field was left blank; credential was renamed/removed after the flow was saved; running against self-hosted Weaviate but connectionType left on 'cloud'.

Related errors


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