Skip to content

Supabase 节点常见问题(Supabase node common issues)#

这里是一些使用 Supabase node 时常见的错误和问题,以及解决或排查它们的步骤。

🌐 Here are some common errors and issues with the Supabase node and steps to resolve or troubleshoot them.

按元数据筛选行(Filtering rows by metadata)#

要按 Supabase 元数据 过滤行,请将 选择类型 设置为 字符串

🌐 To filter rows by Supabase metadata, set the Select Type to String.

从那里,你可以在 Filters (String) 参数中构建查询,使用 Supabase 元数据查询语言 对元数据进行过滤,其灵感来源于 MongoDB 选择器 格式。使用 Postgres ->> 箭头 JSON 操作符 访问元数据属性,如下所示(大括号表示需要填写的部分):

🌐 From there, you can construct a query in the Filters (String) parameter to filter the metadata using the Supabase metadata query language, inspired by the MongoDB selectors format. Access the metadata properties using the Postgres ->> arrow JSON operator like this (curly brackets denote components to fill in):

1
metadata->>{your-property}={comparison-operator}.{comparison-value}

例如,要访问元数据中的 age 属性并返回大于或等于 21 的结果,你可以在 Filters (String) 字段中输入以下内容:

🌐 For example to access an age property in the metadata and return results greater than or equal to 21, you could enter the following in the Filters (String) field:

1
metadata->>age=gte.21

你可以组合这些运算符来构建更复杂的查询。

🌐 You can combine these operators to construct more complex queries.

使用 Docker 时无法连接到本地 Supabase 数据库(Can't connect to a local Supabase database when using Docker)#

在 Docker 中运行 Supabase 时,你需要配置网络,以便 n8n 可以连接到 Supabase。

🌐 When you run Supabase in Docker, you need to configure the network so that n8n can connect to Supabase.

解决方案取决于你如何托管这两个组件。

🌐 The solution depends on how you're hosting the two components.

如果只有 Supabase 在 Docker 容器中(If only Supabase is in Docker)#

如果 Supabase 仅在 Docker 中运行,自托管指南 使用的 Docker Compose 文件已经使 Supabase 绑定到正确的接口。

🌐 If only Supabase is running in Docker, the Docker Compose file used by the self-hosting guide already runs Supabase bound to the correct interfaces.

在配置 Supabase 凭证 时,localhost 地址应该可以正常使用(将 Host 设置为 localhost)。

🌐 When configuring Supabase credentials, the localhost address should work without a problem (set the Host to localhost).

如果 Supabase 和 n8n 运行在不同的 Docker 容器中(If Supabase and n8n are running in separate Docker containers)#

如果 n8n 和 Supabase 都运行在 Docker 的不同容器中,你可以使用 Docker 网络将它们连接起来。

🌐 If both n8n and Supabase are running in Docker in separate containers, you can use Docker networking to connect them.

将 Supabase 配置为通过在容器内绑定到 0.0.0.0 来监听所有接口(官方的 Docker Compose 配置 已经实现了这一点)。如果你尚未在同一个 Docker Compose 文件中管理它们,请将 Supabase 和 n8n 组件添加到同一个 用户自定义桥接网络 中。

🌐 Configure Supabase to listen on all interfaces by binding to 0.0.0.0 inside of the container (the official Docker compose configuration already does this this). Add both the Supabase and n8n components to the same user-defined bridge network if you aren't already managing them together in the same Docker Compose file.

在配置 Supabase 凭据 时,请使用 Supabase API 网关容器的名称(默认情况下为 supabase-kong)作为主机地址,而不是 localhost。例如,如果使用默认配置,则应将 主机 设置为 http://supabase-kong:8000

🌐 When configuring Supabase credentials, use the Supabase API gateway container's name (supabase-kong by default) as the host address instead of localhost. For example, if you use the default configuration, you would set the Host to http://supabase-kong:8000.

记录可通过 Postgres 访问,但无法通过 Supabase 访问(Records are accessible through Postgres but not Supabase)#

如果使用 Supabase 节点查询记录返回为空,但通过 Postgres 节点或使用 Postgres 客户端可以获取记录,则可能与 Supabase 的 行级安全 (RLS) 策略存在冲突。

🌐 If queries for records return empty using the Supabase node, but are available through the Postgres node or with a Postgres client, there may be a conflict with Supabase's Row Level Security (RLS) policy.

当你使用表编辑器在公共模式中创建表时,Supabase 总是会启用 RLS。RLS 激活后,API 在你创建策略之前不会返回任何使用公共 anon 密钥的数据。这是一项安全措施,以确保你只公开你打算公开的数据。

🌐 Supabase always enables RLS when you create a table in a public schema with the Table Editor. When RLS is active, the API doesn't return any data with the public anon key until you create policies. This is a security measure to ensure that you only expose data you intend to.

要以 anon 角色访问启用了 RLS 的表中的数据,请创建策略以启用你打算使用的访问模式。

🌐 To access data from a table with RLS enabled as the anon role, create a policy to enable the access patterns you intend to use.