Diagnose HTTP API issues
HTTP API 问题的症状包括:
🌐 Symptoms of HTTP API issues include:
- HTTP 超时
- 5xx 响应代码
- 响应时间长
资源不足 #
🌐 Under-provisioned resources
导致 HTTP 超时和 5xx 响应代码的最常见问题类别是你的项目资源配置不足。这可能导致你的项目无法处理接收到的流量。
🌐 The most common class of issues that causes HTTP timeouts and 5xx response codes is the under-provisioning of resources for your project. This can cause your project to be unable to service the traffic it is receiving.
每个 Supabase 项目都会配备独立的计算资源。这意味着项目可以处理无限的请求,只要这些请求可以在已分配的资源内完成。复杂的查询,或者处理大量数据的查询,会需要更多的资源。因此,能够处理大量基础查询(或少量数据查询)的资源,可能无法处理相同数量的复杂查询。
🌐 Each Supabase project is provisioned with segregated compute resources. This allows the project to serve unlimited requests, as long as they can be handled using the resources that have been provisioned. Complex queries, or queries that process larger amounts of data, will require higher amounts of resources. As such, the amount of resources that can handle a high volume of basic queries (or queries involving small amounts of data), will likely be unable to handle a similar volume of complex queries.
你可以通过 仪表板中的报告 查看你 Supabase 项目的资源使用情况。
🌐 You can view the resource utilization of your Supabase Project using the reports in the Dashboard.
这个问题的一些常见解决办法有:
🌐 Some common solutions for this issue are:
- 为了处理更高的流量,升级到更大的计算附加组件。
- 正在优化正在执行的查询。
- 使用更少的 Postgres 连接 可以减少项目所需的资源。
- 重新启动 项目。这只是通过终止可能占用你计算资源的任何正在运行的工作负载来暂时解决问题。
如果你的磁盘IO预算已经用完,你需要么等到第二天它被补充,要么升级到更大的计算附加组件,以增加你项目可用的预算。
🌐 If your Disk IO budget has been drained, you will need to either wait for it to be replenished the next day, or upgrade to a larger compute add-on to increase the budget available to your project.
无法连接到你的 Supabase 项目 #
🌐 Unable to connect to your Supabase project
症状:你无法直接连接到你的 Postgres 数据库,但可以在 Supabase 控制台 打开项目。
🌐 Symptom: You're unable to connect to your Postgres database directly, but can open the Project in the Supabase Dashboard.
打开的连接太多了 #
🌐 Too many open connections
关于打开连接过多的错误可以通过重启数据库来_临时_解决。不过,这并不能从根本上解决问题,想要永久解决还得另想办法。
🌐 Errors about too many open connections can be temporarily resolved by restarting the database. However, this won't solve the underlying issue for a permanent solution.
- 如果你遇到
No more connections allowed (max_client_conn)错误: - 如果你在尝试上述建议时,还收到
sorry, too many clients already或remaining connection slots are reserved for non-replication superuser connections错误信息,可以改用 连接池 。
连接被拒绝 #
🌐 Connection refused
如果在几次初始连接尝试失败后收到 connection refused 错误,你的客户端很可能已经被临时阻止,这是为了保护数据库免受暴力攻击。你可以等 30 分钟后再使用正确的密码尝试,或者你可以联系支持并提供你客户端的 IP 地址来手动解封。
🌐 If you receive a connection refused error after a few initial failed connection attempts, your client has likely been temporarily blocked in order to protect the database from brute-force attacks. You can wait 30 minutes before trying again with the correct password, or you can contact support with your client's IP address to manually unblock you.
如果你也无法使用 Supabase 控制台 打开项目,请查看针对 资源不足的项目 的解决方案。
🌐 If you're also unable to open the project using the Supabase Dashboard, review the solutions for under-provisioned projects.