google / google/csv-to-firestore
Deploying Issue for CSV to Firestore
- Dominant language
- Python
- Stars
- 27
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
We are deploying using the example command in the documentation.
And we see
**ERROR: (gcloud.functions.deploy) wrong collection: expected [storage.objects], got [storage.buckets], for path**
Is this our issue or a version issue or a source issue?
We'd like to be able to deploy the function.
The full debug trace is shown below:
I'm not sure if it matters but the local python installed is 3.9.18
```
python -V
Python 3.9.18
```
```
$ gcloud functions deploy csv_to_firestore --runtime python39 --trigger-resource gs://citytri-marketing.appspot.com/config --trigger-event google.storage.object.finalize --entry-point csv_to_firestore_trigger --source . --memory=1024MB --set-env-vars=UPLOAD_HISTORY=FALSE,EXCLUDE_DOCUMENT_ID_VALUE=FALSE --timeout=540 --verbosity debug
DEBUG: Running [gcloud.functions.deploy] with arguments: [--entry-point: "csv_to_firestore_trigger", --memory: "1024MB", --runtime: "python39", --set-env-vars: "OrderedDict([('UPLOAD_HISTORY', 'FALSE'), ('EXCLUDE_DOCUMENT_ID_VALUE', 'FALSE')])", --source: ".", --timeout: "540", --trigger-event: "google.storage.object.finalize", --trigger-resource: "gs://citytri-marketing.appspot.com/config", --verbosity: "debug", NAME: "csv_to_firestore"]
DEBUG: Starting new HTTPS connection (1): cloudfunctions.googleapis.com:443
DEBUG: https://cloudfunctions.googleapis.com:443 "GET /v2/projects/web3-marketing/locations/us-central1/functions/csv_to_firestore?alt=json HTTP/1.1" 404 None
In a future Cloud SDK release, new functions will be deployed as 2nd gen functions by default. This is equivalent to currently deploying new with the --gen2 flag. Existing 1st gen functions will not be impacted and will continue to deploy as 1st gen functions.
You can preview this behavior in beta. Alternatively, you can disable this behavior by explicitly specifying the --no-gen2 flag or by setting the functions/gen2 config property to 'off'.
To learn more about the differences between 1st gen and 2nd gen functions, visit:
https://cloud.google.com/functions/docs/concepts/version-comparison
DEBUG: (gcloud.functions.deploy) wrong collection: expected [storage.objects], got [storage.buckets], for path [gs://citytri-marketing.appspot.com/config]
Traceback (most recent call last):
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 998, in Execute
resources = calliope_command.Run(cli=self, args=args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 815, in Run
resources = command_instance.Run(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/v1/util.py", line 387, in CatchHTTPErrorRaiseHTTPExceptionFn
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/command_lib/functions/util.py", line 88, in Run
return self._RunV1(args)
^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/surface/functions/deploy.py", line 145, in _RunV1
return command_v1.Run(args, track=self.ReleaseTrack())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/command_lib/functions/v1/deploy/command.py", line 460, in Run
trigger_params = trigger_util.GetTriggerEventParams(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/command_lib/functions/v1/deploy/trigger_util.py", line 216, in GetTriggerEventParams
return _GetEventTriggerEventParams(trigger_event, trigger_resource)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/command_lib/functions/v1/deploy/trigger_util.py", line 167, in _GetEventTriggerEventParams
trigger_resource = storage_util.BucketReference.FromUrl(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/api_lib/storage/storage_util.py", line 166, in FromUrl
return cls(resources.REGISTRY.Parse(url, collection='storage.buckets')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/resources.py", line 1201, in Parse
return self.ParseStorageURL(line, collection=collection)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ralph/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/resources.py", line 1103, in ParseStorageURL
raise WrongResourceCollectionException('storage.objects', collection,
googlecloudsdk.core.resources.WrongResourceCollectionException: wrong collection: expected [storage.objects], got [storage.buckets], for path [gs://citytri-marketing.appspot.com/config]
ERROR: (gcloud.functions.deploy) wrong collection: expected [storage.objects], got [storage.buckets], for path [gs://citytri-marketing.appspot.com/config]
```
Contributor guide
Assessment
This issue has not been assessed yet.