n8n-io/n8n · error · UserError

Expected Supabase credentials host to be a string

Error message

Expected Supabase credentials host to be a string

What it means

A UserError from supabaseTableNameSearch (an ILoadOptionsFunctions credential-loading helper). It loads supabaseApi credentials and requires credentials.host to be a string before building the PostgREST URL; if the host is not a string it refuses to proceed. UserError means the user's configuration caused it.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/shared/methods/listSearch.ts:33

	});

	const indexes = await client.listIndexes();

	const results = (indexes.indexes ?? []).map((index) => ({
		name: index.name,
		value: index.name,
	}));

	return { results };
}

export async function supabaseTableNameSearch(this: ILoadOptionsFunctions) {
	const credentials = await this.getCredentials('supabaseApi');

	const results = [];

	if (typeof credentials.host !== 'string') {
		throw new UserError('Expected Supabase credentials host to be a string');
	}

	const { paths } = (await this.helpers.requestWithAuthentication.call(this, 'supabaseApi', {
		headers: {
			Prefer: 'return=representation',
		},
		method: 'GET',
		uri: `${credentials.host}/rest/v1/`,
		json: true,
	})) as { paths: IDataObject };

	for (const path of Object.keys(paths)) {
		//omit introspection path
		if (path === '/') continue;

		results.push({
			name: path.replace('/', ''),
			value: path.replace('/', ''),

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Open the Supabase credential in n8n and fill the host/Project URL field with the full PostgREST base (e.g. https://<project>.supabase.co).
  2. Re-save the credential after entering both host and serviceRole key.
  3. Confirm the credential record used by the node is the updated one (not a stale duplicate).
  4. If loading via API/JSON, ensure host is a string before assigning.

Example fix

// before: credentials.host = undefined (field blank)
// after:  credentials.host = 'https://abcdefgh.supabase.co'
Defensive patterns

Strategy: type-guard

Validate before calling

const credentials = await this.getCredentials('supabaseApi'); if (typeof credentials.host !== 'string' || !credentials.host) { throw new Error('Configure the Supabase credential host (Project URL) before loading tables.'); }

Type guard

function hasStringHost(c: unknown): c is { host: string } { return !!c && typeof (c as any).host === 'string' && (c as any).host.length > 0; }

Try / catch

if (!hasStringHost(credentials)) { promptForCredential('supabaseApi'); return []; }

Prevention

When it happens

Trigger: The Supabase table-name dropdown/option loader runs, getCredentials('supabaseApi') returns an object whose host is not a string (undefined, number, null) — e.g. credential fields left blank or a malformed credential record.

Common situations: Supabase credential 'host' (Project URL) left empty; credential partially saved; credential data corrupted or migrated incorrectly; the credential type changed and host is now under a different field name.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/97db08aee6c7144b. Report an issue: GitHub.