Skip to content

b2sdk._internal.exception.BadRequest: Rule with prefix '' must have at least one additional property defined (bad_request) #101

@cinemast

Description

@cinemast

While trying to change the CORS rules in one of our buckets, we receive the following error:

 # b2_bucket.media_bucket will be updated in-place
  ~ resource "b2_bucket" "media_bucket" {
        id          = "<redacted>"
        # (7 unchanged attributes hidden)

      ~ cors_rules {
          ~ allowed_origins    = [
                # (1 unchanged element hidden)
                "http://localhost:5173",
              + "https://localhost:5173",
                "http://localhost:4173",
              + "https://localhost:4173",
            ]
            # (5 unchanged attributes hidden)
        }

        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions in workspace "test"?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

b2_bucket.media_bucket: Modifying... [id=<redacted>]
╷
│ Error: Traceback (most recent call last):
│   File "b2_terraform/provider_tool.py", line 606, in run_command
│   File "b2_terraform/provider_tool.py", line 132, in run
│   File "b2_terraform/provider_tool.py", line 281, in resource_update
│   File "b2sdk/_internal/session.py", line 329, in update_bucket
│   File "b2sdk/_internal/session.py", line 451, in _wrap_default_token
│   File "b2sdk/_internal/session.py", line 457, in _wrap_token
│   File "b2sdk/_internal/session.py", line 472, in _reauthorization_loop
│   File "b2sdk/_internal/session.py", line 462, in _api_token_callback
│   File "b2sdk/_internal/raw_api.py", line 917, in update_bucket
│   File "b2sdk/_internal/raw_api.py", line 546, in _post_json
│   File "b2sdk/_internal/b2http.py", line 390, in post_json_return_json
│   File "b2sdk/_internal/b2http.py", line 356, in post_content_return_json
│   File "b2sdk/_internal/b2http.py", line 309, in request_content_return_json
│   File "b2sdk/_internal/b2http.py", line 279, in request
│   File "b2sdk/_internal/b2http.py", line 588, in _translate_and_retry
│   File "b2sdk/v2/b2http.py", line 22, in _translate_errors
│   File "b2sdk/_internal/b2http.py", line 520, in _translate_errors
│ b2sdk._internal.exception.BadRequest: Rule with prefix '' must have at least one additional property defined (bad_request)
│
│
│   with b2_bucket.media_bucket,
│   on main.tf line 87, in resource "b2_bucket" "media_bucket":
│   87: resource "b2_bucket" "media_bucket" {
│
╵

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions