Skip to content

Conversation

ybr
Copy link

@ybr ybr commented Sep 25, 2025

Only send schemaName to API if it differs from the remote state

This prevents API failures when the schema name already exists in the warehouse. The Segment API fails if we send a schemaName that matches the current configuration, even though it should be a no-op

Only send schemaName to API if it differs from the remote state

This prevents API failures when the schema name already exists in the warehouse.
The Segment API fails if we send a schemaName that matches the current configuration, even though it should be a no-op
@ybr ybr requested a review from a team as a code owner September 25, 2025 13:15
@deanhuynh
Copy link
Contributor

Hi thanks for contributing! What error are you seeing here exactly? And do you have reproduction steps? I would like to check if this is something we can fix on the backend.

@ybr
Copy link
Author

ybr commented Oct 2, 2025

Hi thanks for contributing! What error are you seeing here exactly? And do you have reproduction steps? I would like to check if this is something we can fix on the backend.

Hello Dean,

Sure. I had a case opened with Segment Support 575344.

Anytime the Segment API is called to update a profiles warehouse with the schemaName field, it fails with the below error. Even if the schemaName is the one already set in Segment for the same profiles warehouse (which looks like a no-op to me).
The Segment provider sends this schemaName field whatever what, even if unspecified or in ignore_changes.

Reproduction steps:

  1. create using terraform a segment_profiles_warehouse
  2. make terraform to update it like by changing the secret to connect with the warehouse (in the settings of the resource)

Error :

│ 400 Bad Request
│ {
│ "errors": [
│ {
│ "type": "bad-request",
│ "message": "Could not validate schema name. Error: schema found in the warehouse. Please check and try again."
│ }
│ ]
│ }

This error appears anytime the profiles warehouse requires an update of any kind.

The real use case we had:

  1. A space was setup with its profiles warehouse manually through the Segment UI
  2. We want to terraform Segment resources, so we use import and segment_profiles_warehouse terraform instructions to have them imported and managed by Segment.

Same error as above. The import works fine, but the definition not being exactly the same between manually created Segment resource and how it is defined in terraform code, terraform tries to update it.

I have been investigating the behavior of the Segment API using curl, you can PATCH the profiles warehouse but as soon as you send the schemaName field, the API fails.

I have been told by the support it is not workable to change the API so I volunteered to create this PR.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants