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

'Subscription.name has already been set error' occurring PubSub Emulator #249

Closed
AdamLazarus opened this issue Nov 23, 2016 · 5 comments
Closed
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@AdamLazarus
Copy link

This error occurs in the PubSub emulator when trying to create a subscription with some standard code. Example code with reproduction steps in comment: [1]

After some investigation it looks like the problem is a bug in the Pub/Sub client library that causes the subscription name to be included twice in the JSON. In the API reference[2] 'name' is listed as a path parameter but it's also available as an option to be included in the request body. We've tried calling the API using curl and confirmed that the error only occurs when name is included in the request body. There appears to be a discrepancy between how Pub/Sub behaves on production as it accepts both variants while the emulator fails with a repeated 'name'.

I've tried rolling back to previous versions of the client library but the issue still occurs.
[1] http://pastebin.com/awT5km9Z
[2]https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/create

@jdpedrie
Copy link
Contributor

Hi @AdamLazarus, sorry about the trouble you're having. I've confirmed your report, and I'm working on figuring out how to get it resolved. I will keep you posted!

@jdpedrie jdpedrie added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: pubsub Issues related to the Pub/Sub API. emulators labels Nov 23, 2016
@jdpedrie jdpedrie self-assigned this Nov 23, 2016
@dwsupplee
Copy link
Contributor

Had just started taking a look before your message @jdpedrie. It looks like the emulator is more strict in what data it accepts. According to the service definition, the name exists in the path and also as part of the Subscription schema which is what delivered in the body of the request.

First thought is to unset any incoming options after we have assigned them to the proper portions of the request. Sound okay?

@jdpedrie
Copy link
Contributor

Hey @AdamLazarus, would you mind trying to run your code against the changes in #251 and see if it solves your problem?

@dwsupplee
Copy link
Contributor

Going to leave this open until we hear back from @AdamLazarus

@AdamLazarus
Copy link
Author

Looks like it's fixed with #251. Thanks very much!

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants