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

fix GCP pub/sub auth issue - remore redundant apikey param #427

Merged
merged 3 commits into from
Nov 13, 2017
Merged

fix GCP pub/sub auth issue - remore redundant apikey param #427

merged 3 commits into from
Nov 13, 2017

Conversation

andyoll
Copy link
Contributor

@andyoll andyoll commented Jul 27, 2017

  • remove 'apikey' param from HTTP request URL for GCP Pub/Sub publish request.

…sh request #426

* remove 'apikey' param from HTTP request URL for GCP Pub/Sub publish request.
@lightbend-cla-validator

Hi @andyoll,

Thank you for your contribution! We really value the time you've taken to put this together.

We see that you have signed the Lightbend Contributors License Agreement before, however, the CLA has changed since you last signed it.
Please review the new CLA and sign it before we proceed with reviewing this pull request:

http://www.lightbend.com/contribute/cla

@andyoll
Copy link
Contributor Author

andyoll commented Jul 27, 2017

CLA signed

@raboof
Copy link
Contributor

raboof commented Jul 28, 2017

@andyoll it seems the travis build is failing because scalariform disagrees with some whitespace

@andyoll
Copy link
Contributor Author

andyoll commented Jul 30, 2017

There remains a failing test in #1005.3 - a problem with connecting to MQTT server.
[info] *** 1 TEST FAILED ***
[error] Failed: Total 13, Failed 1, Errors 0, Passed 12
[error] Failed tests:
[error] akka.stream.alpakka.mqtt.scaladsl.MqttSourceSpec
....
Unable to connect to server. (MqttSourceSpec.scala:198)

@andyoll
Copy link
Contributor Author

andyoll commented Aug 14, 2017

@raboof - is there a means to get Travis to re-run tests for this PR (without making a dummy commit) - I'm thinking the failed test is not caused by my changes, but due to an environment problem when Travis ran..

@andyoll
Copy link
Contributor Author

andyoll commented Aug 23, 2017

going to close and re-open this PR to force new Travis build

@andyoll andyoll closed this Aug 23, 2017
@andyoll andyoll reopened this Aug 23, 2017
@raboof
Copy link
Contributor

raboof commented Aug 23, 2017

@andyoll ah sorry I seem to have missed your previous message. Other tests should interfere less once we merge #419 :)

Copy link
Contributor

@raboof raboof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://groups.google.com/forum/#!topic/cloud-pubsub-discuss/8fGaG5cWiTk suggests the 'key' parameter can be useful when authenticating to something public - is that not (or no longer) the case?

@@ -102,7 +102,7 @@ private trait HttpApi {
): Future[immutable.Seq[String]] = {
import materializer.executionContext

val url: Uri = s"$PubSubGoogleApisHost/v1/projects/$project/topics/$topic:publish?key=$apiKey"
val url: Uri = s"$PubSubGoogleApisHost/v1/projects/$project/topics/$topic:publish"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm too bad we didn't have a test that touched this part of the flow - can you think of a reasonable one to add?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key param seems to make auth fail - whereas, with it removed auth works nicely.
Regarding tests: there is a test defined in google-cloud-pub-sub/src/test/scala/akka/stream/alpakka/googlecloud/pubsub/HttpApiSpec.scala with mocking, that I updated as part of this PR. The only means to improve this to ensure the code 'really works' (that I can think of), is to actually hit the Google API, with real credentials - this could guard against any future behaviour changes. What do you think?

@raboof
Copy link
Contributor

raboof commented Aug 23, 2017

(mqtt failure again, restarted that travis build)

@@ -80,7 +80,7 @@ class HttpApiSpec extends FlatSpec with BeforeAndAfterAll with ScalaFutures with
mock.register(
WireMock
.post(
urlEqualTo(s"/v1/projects/${TestCredentials.projectId}/topics/topic1:publish?key=${TestCredentials.apiKey}")
urlEqualTo(s"/v1/projects/${TestCredentials.projectId}/topics/topic1:publish")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I didn't realize this is a check, not a 'given' 👍

@stephennancekivell
Copy link
Contributor

Thanks guys. I originally added that and can confirm the apikey is redundant. I've since learnt better. :)

@yanns
Copy link

yanns commented Oct 4, 2017

I agree with @smithzd. Using Pub-Sub in a pull mode does not need any apiKey.

@smithzd
Copy link

smithzd commented Oct 5, 2017

I think it needs to be removed from the ack as well -- I tested pull and ack without it and it works.

@geoffjentry
Copy link

Hi - as someone who just ran into this, what's the status of this PR? As far as I can tell it's not just redundant it's simply not allowed, e.g. pubsub isn't one of the supported APIs for api keys

Copy link
Contributor

@raboof raboof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming, please open separate PR's/tickets for any other calls where the same change is needed.

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

Successfully merging this pull request may close these issues.

7 participants