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

com.google.showcase.v1beta1.MessagingClientHttpJsonTest#updateBlurbTest failing with 404 error #1547

Closed
mpeddada1 opened this issue Mar 23, 2023 · 2 comments · Fixed by #1818
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mpeddada1
Copy link
Contributor

Stacktrace:

com.google.api.gax.rpc.NotFoundException: com.google.api.client.http.HttpResponseException: 404
POST https://localhost:7469/v1beta1/users/%5BUSER%5D/profile/blurbs/legacy/%5BLEGACY_USER%5D~%5BBLURB%5D?updateMask
Method not found for path 'https:///v1beta1/users/%5BUSER%5D/profile/blurbs/legacy/%5BLEGACY_USER%5D~%5BBLURB%5D'

	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:90)
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:41)
	at com.google.api.gax.httpjson.HttpJsonApiExceptionFactory.createApiException(HttpJsonApiExceptionFactory.java:75)
	at com.google.api.gax.httpjson.HttpJsonApiExceptionFactory.create(HttpJsonApiExceptionFactory.java:54)
	at com.google.api.gax.httpjson.HttpJsonExceptionCallable$ExceptionTransformingFuture.onFailure(HttpJsonExceptionCallable.java:97)
	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:67)
	at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1132)
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1270)
	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:1038)
	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:808)
	at com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:92)
	at com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:74)
	at com.google.api.gax.httpjson.HttpJsonClientCalls$HttpJsonFuture.setException(HttpJsonClientCalls.java:112)
	at com.google.api.gax.httpjson.HttpJsonClientCalls$FutureListener.onClose(HttpJsonClientCalls.java:146)
	at com.google.api.gax.httpjson.HttpJsonClientCallImpl$OnCloseNotificationTask.call(HttpJsonClientCallImpl.java:490)
	at com.google.api.gax.httpjson.HttpJsonClientCallImpl.notifyListeners(HttpJsonClientCallImpl.java:339)
	at com.google.api.gax.httpjson.HttpJsonClientCallImpl.deliver(HttpJsonClientCallImpl.java:266)
	at com.google.api.gax.httpjson.HttpJsonClientCallImpl.setResult(HttpJsonClientCallImpl.java:149)
	at com.google.api.gax.httpjson.HttpRequestRunnable.run(HttpRequestRunnable.java:149)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	Suppressed: com.google.api.gax.rpc.AsyncTaskException: Asynchronous task failed
		at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57)
		at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112)
		at com.google.showcase.v1beta1.MessagingClient.updateBlurb(MessagingClient.java:1307)
		at com.google.showcase.v1beta1.MessagingClientHttpJsonTest.updateBlurbTest(MessagingClientHttpJsonTest.java:1195)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
		at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
		at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
		at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
		at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
		at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
		at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
		at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
		at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
		at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
		at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
		at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
		at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
		at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
		at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
		at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
		at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
		at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
		at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
		at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
		at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
		at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
		at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
		at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
		at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
		at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
		at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
		at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: com.google.api.client.http.HttpResponseException: 404
POST https://localhost:7469/v1beta1/users/%5BUSER%5D/profile/blurbs/legacy/%5BLEGACY_USER%5D~%5BBLURB%5D?updateMask
Method not found for path 'https:///v1beta1/users/%5BUSER%5D/profile/blurbs/legacy/%5BLEGACY_USER%5D~%5BBLURB%5D'
	at com.google.api.client.http.HttpResponseException$Builder.build(HttpResponseException.java:293)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1118)
	at com.google.api.gax.httpjson.HttpRequestRunnable.run(HttpRequestRunnable.java:118)
	... 6 more
@lqiu96
Copy link
Contributor

lqiu96 commented Mar 23, 2023

Thanks @mpeddada1. I took a look at this and I think there are possibly two issues (I say possibly two as of right now since I need to do some more digging on the second one).

The first issue is that we're not checking the additional paths in this RPC:
https://github.com/googleapis/gapic-showcase/blob/2f44f5bc2acef3dd4dadd233fedb0d5e55b8a00d/schema/google/showcase/v1beta1/messaging.proto#L113-L116

The request comes in as

            .setBlurb(
                Blurb.newBuilder()
                    .setName(
                        BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
                            .toString())
                    .setUser(UserName.of("[USER]").toString())
                    .setCreateTime(Timestamp.newBuilder().build())
                    .setUpdateTime(Timestamp.newBuilder().build())
                    .build())

which should map to the additional_bindings URL of `/v1beta1/users/[USER]/profile/blurbs/[BLURB]}. Plus the brackets ([ and ]) need to be url encoded (https://www.w3schools.com/tags/ref_urlencode.ASP)

I have an issue already tracking this: #1440

The second (possible) issue is that there is a a concept of a legacy Blurb: https://github.com/googleapis/gapic-showcase/blob/2f44f5bc2acef3dd4dadd233fedb0d5e55b8a00d/schema/google/showcase/v1beta1/messaging.proto#L320-L329 and https://github.com/googleapis/gapic-showcase/blob/2f44f5bc2acef3dd4dadd233fedb0d5e55b8a00d/schema/google/showcase/v1beta1/messaging.proto#L284-L290

For some reason it defaults to using the legacy blurb:

BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString()

which encodes the url to be /v1beta1/users/[USER]/profile/blurbs/[LEGACY_USER][BLURB]} and that 404's

Instead of using

                    .setName(
                        BlurbName.ofUserBlurbName("[USER]", "[BLURB]")
                            .toString())

which would make the test pass.

@lqiu96 lqiu96 mentioned this issue Mar 24, 2023
27 tasks
@blakeli0 blakeli0 added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Mar 31, 2023
@lqiu96
Copy link
Contributor

lqiu96 commented Jun 20, 2023

Adding in the new IAM files has the same issue for a bunch of IAM related RPCs. I will revisit this issue. For now, I am going to exclude the files as part of the IAM showcase tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants