Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_firestore_document.document: GoogleApi Error 400: Missing routing header #15550

Closed
ch3ck opened this issue Aug 17, 2023 · 7 comments
Closed

Comments

@ch3ck
Copy link

ch3ck commented Aug 17, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.5.0
on linux_amd64

Your version of Terraform is out of date! The latest version
is 1.5.5. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • google_firestore_document

Terraform Configuration Files

resource "google_firestore_document" "documents" {
  for_each = { for doc in var.collections : doc.document => doc }

  provider    = google-beta
  project     = local.project_id
  database    = var.database_name
  collection  = each.value.collection
  document_id = each.value.document
  fields      = jsonencode(each.value.fields)

  depends_on = [
    google_firestore_database.firestore
  ]
}

Debug Output

Panic Output

See error below

Expected Behavior

No error

Actual Behavior

google_firestore_document.documents["fake-test-user"]: Creating...
╷
│ Error: Error creating Document: googleapi: Error 400: Missing routing header. Please fill in the request header with format x-goog-request-params:project_id=XXXXXXX. Please refer to https://firebase.google.com/docs/firestore/manage-databases#access_a_named_database_with_a_client_library for more details.
...

Steps to Reproduce

  1. terraform apply

Important Factoids

Terraform provider:

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = "4.78.0"
    }
  }
}

provider "google" {
  # Configuration options
}

References

@ch3ck ch3ck added the bug label Aug 17, 2023
@github-actions github-actions bot added forward/review In review; remove label to forward service/firestore-dataplane labels Aug 17, 2023
@edwardmedia
Copy link
Contributor

b/296467504

@edwardmedia edwardmedia added forward/linked and removed forward/review In review; remove label to forward labels Aug 17, 2023
rwhogg added a commit to rwhogg/magic-modules that referenced this issue Jan 18, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The basic Field example is also creating its own project and its
  own database now for test isolation purposes. It might be sufficient
  to just create a database the same way as for backup schedules;
  we can evaluate that once the tests have been passing for a while.
* The other two Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
rwhogg added a commit to rwhogg/magic-modules that referenced this issue Jan 19, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
rwhogg added a commit to rwhogg/magic-modules that referenced this issue Jan 19, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
rwhogg added a commit to rwhogg/magic-modules that referenced this issue Jan 19, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
rwhogg added a commit to rwhogg/magic-modules that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
hao-nan-li pushed a commit to GoogleCloudPlatform/magic-modules that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
modular-magician added a commit to modular-magician/terraform-provider-google-beta that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
[upstream:003fa68204d7bcff11e5153364e8c6eb950155ed]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
[upstream:003fa68204d7bcff11e5153364e8c6eb950155ed]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
[upstream:003fa68204d7bcff11e5153364e8c6eb950155ed]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to hashicorp/terraform-provider-google-beta that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
[upstream:003fa68204d7bcff11e5153364e8c6eb950155ed]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/terraform-google-conversion that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
[upstream:003fa68204d7bcff11e5153364e8c6eb950155ed]

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to GoogleCloudPlatform/terraform-google-conversion that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
[upstream:003fa68204d7bcff11e5153364e8c6eb950155ed]

Signed-off-by: Modular Magician <[email protected]>
arnabadg-google pushed a commit to arnabadg-google/mm-arnabadg that referenced this issue Jan 22, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
@narendraaduri1
Copy link

please look at this issue Error: Error creating Document: googleapi: Error 400: Missing routing header. Please fill in the request header with format x-goog-request-params:project_id=xxxxxxxx&database_id=firestoredatabase02. Please refer to https://firebase.google.com/docs/firestore/manage-databases#access_a_named_database_with_a_client_library for more details.

tdbhacks pushed a commit to tdbhacks/magic-modules that referenced this issue Feb 6, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
@nguyen-vo
Copy link

hi, will this issue be fixed soon and are there any workaround in the mean time

@melinath
Copy link
Collaborator

melinath commented Apr 9, 2024

This should now be resolved.

@ch3ck
Copy link
Author

ch3ck commented Apr 10, 2024

@melinath which provider version has this fix?

@melinath
Copy link
Collaborator

The API no longer requires the routing header, so it should work in all provider versions that support this resource. Definitely let us know if that doesn't seem to be the case!

balanaguharsha pushed a commit to balanaguharsha/magic-modules that referenced this issue May 2, 2024
There's a whole bunch of different constraints that have to be met
for these tests to pass consistently.

* Backup schedules need to be run in a project with billing enabled,
  and the database needs a deletion policy to ensure it is properly swept.
* The default-database examples were marked as skip-test.
  They're valuable as examples but not really as tests - there's nothing
  Terraform-specific about them worth testing - and the Field tests
  will fail if default database creation doesn't work in Terraform
* The Document tests need to run against the (default) database due
  to an existing bug
  (hashicorp/terraform-provider-google#15550).
  So they will now create their own project and their own (default)
  database.
* The Field examples are following the same pattern as
  the backup schedule examples.
* The Firestore-native index example is using the inband project
  creation method, because then we can use the (default) database,
  which means we can use the Document resource (see the above-mentioned bug),
  which means that we don't need to use a manually-created project (because creating
  a Document implicitly creates its collection).
* The Datastore mode Index example can't take that same approach, because it doesn't
  seem like the Document resource works on datastore-mode databases. So we will need
  to use the manually-created FIRESTORE_PROJECT_NAME project for that one, and it will
  need to have a Datastore mode database manually baked into it.

 This exercise has identified a fair number of places for improvement to the Firestore
 Terraform story, but as a stopgap to get the tests passing again, this will have to do.
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants