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

Datastream UpdateStreamRequest #12593

Closed
underdog-tmac opened this issue Apr 18, 2024 · 4 comments
Closed

Datastream UpdateStreamRequest #12593

underdog-tmac opened this issue Apr 18, 2024 · 4 comments

Comments

@underdog-tmac
Copy link

While attempting to update a datastream stream, there seems to be a bug.

from google.cloud import datastream
client = datastream.DatastreamClient()
client._project = "someproject"

update_stream = datastream.Stream()
update_stream.state = datastream.Stream.State(7)# trying to setting the state to any of the enum values does not work.
update_stream.display_name = 'an_already_existing_stream'
update_request = datastream.UpdateStreamRequest(stream=update_stream)

operation = uclient.update_stream(request=update_request)
update_response = operation.result()

ends up in this error message:

traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.9/site-packages/google/api_core/grpc_helpers.py", line 72, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.9/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/opt/anaconda3/lib/python3.9/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.INVALID_ARGUMENT
	details = "Invalid resource field value in the request."
	debug_error_string = "UNKNOWN:Error received from peer ipv6:******************************************************* {created_time:"2024-04-18T16:22:39.880432-04:00", grpc_status:3, grpc_message:"Invalid resource field value in the request."}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/lib/python3.9/site-packages/google/cloud/datastream_v1/services/datastream/client.py", line 2033, in update_stream
    response = rpc(
  File "/opt/anaconda3/lib/python3.9/site-packages/google/api_core/gapic_v1/method.py", line 113, in __call__
    return wrapped_func(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.9/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.9/site-packages/google/api_core/grpc_helpers.py", line 74, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InvalidArgument: 400 Invalid resource field value in the request. [reason: "RESOURCE_PROJECT_INVALID"
domain: "googleapis.com"
metadata {
  key: "method"
  value: "google.cloud.datastream.v1.Datastream.UpdateStream"
}
metadata {
  key: "service"
  value: "datastream.googleapis.com"
}

]

Its not clear exactly why this is occuring.

@ohmayr
Copy link
Contributor

ohmayr commented Apr 24, 2024

@underdog-tmac Thanks for reporting this issue. The "RESOURCE_PROJECT_INVALID" in the error message means that the project is either not specified or missing.

You will need to set the project name as part of the stream in the following way:

update_stream = datastream.Stream()
update_stream.name = "project_name"

This should resolve the error that you're getting. Please feel free to let us know if it does not.

I agree that the documentation is a bit misleading and does not state how to include the project name as part of the request.

@ohmayr
Copy link
Contributor

ohmayr commented Apr 24, 2024

Have filed an issue to update the samples to include this a required field: googleapis/gapic-generator-python#2017.

Please let us know if you still encounter any issues.

@underdog-tmac
Copy link
Author

Thank you! i'll check it out and hopefully that resolves any issues I had.

@ohmayr
Copy link
Contributor

ohmayr commented May 7, 2024

Closing this issue since it was addressed in an earlier comment.

@ohmayr ohmayr closed this as completed May 7, 2024
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

No branches or pull requests

2 participants