Skip to content

Creating supabase_settings with network settings directly after supabase_project almost always fails #239

@pathob

Description

@pathob

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When creating supabase_settings with network settings directly after supabase_project, the operation almost always fails.

Terraform / Opentofu code:

resource "supabase_project" "supabase_project" {
  organization_id   = var.supabase_organisation_id
  name              = var.supabase_project_name
  database_password = random_password.database_password.result
  # ...
}

resource "supabase_settings" "supabase_settings" {
  project_ref = supabase_project.supabase_project.id

  # Example: Allow access from all networks
  network = jsonencode({
    restrictions = [
      "0.0.0.0/0",
      "::/0"
    ]
  })

  # ...

  depends_on      = [supabase_project.supabase_project]
}

Error message:

* Failed to execute "tofu apply -auto-approve" in opentofu/backend
  ╷
  │ Error: Client Error
  │ 
  │   with supabase_settings.supabase_settings,
  │   on main.tf line 25, in resource "supabase_settings" "supabase_settings":
  │   25: resource "supabase_settings" "supabase_settings" {
  │ 
  │ Unable to update network settings, got status 500: {"message":"error adding
  │ pooler tenant for
  │ us-east-1/abc...","errorEventId":"123..."}
  ╵

When rerunning the pipeline, it always succeeds.

I've already added a 1-minute sleep between both operations which worked okayish for a while until last week. However, I don't consider a sleep-command a proper way to handle this case. The proper way in my opinion would be that the create-operation of the instance itself waits until it can be used or that the settings have some kind of internal async wait, retry or whatever.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create supabase_settings with network settings directly after supabase_project, see above

Expected behavior

The creation of both resources always succeeds.

Screenshots

None

System information

  • OS:
  • Browser:
  • Version of supabase-js:
  • Version of Node.js:

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions