Skip to content

feat: Support Pub/Sub push notifications format (adapt to CloudEvent) #238

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

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

jskeet
Copy link
Member

@jskeet jskeet commented Feb 15, 2022

Fixes #234

@jskeet
Copy link
Member Author

jskeet commented Feb 15, 2022

Note: tested with both the PubSub emulator and the production service

Copy link
Member

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

LGTM

then the Functions Framework will infer the topic name from the path
of the HTTP request. If the topic name cannot be inferred
automatically, a topic name of
`projects/unknown-project!/topics/unknown-topic!` will be used in
Copy link
Member

Choose a reason for hiding this comment

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

It seems like we aren't consistent about what we use here across languages.

  • In Node.js we just drop it and make the CE subject //pubsub.googleapis.com/
  • In Ruby we set it to //pubsub.googleapis.com/UNKNOWN_PUBSUB_TOPIC

Also, I think it is might be possible to always extract the project name from the subscription in the payload.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems like we aren't consistent about what we use here across languages.

Mmm. The reason I chose this is to keep structure that will work in the absence of "real" data, but make it obvious that it's not real data. That may or may not be a good choice. Let's discuss this more before actually releasing.

Also, I think it is might be possible to always extract the project name from the subscription in the payload.

That assumes that the subscription is in the same project as the topic, which may not be the case. (I think cross-project PubSub subscriptions are a thing, with appropriate IAM. I could be wrong.) For the emulator that doesn't matter, but for the genuine PubSub push notifications, I think it's better to give either "obviously wrong" data or "user-specified data" (the URL path) rather than "looks plausible but may be wrong" data.

We should definitely talk about that part more. I'm going to merge this as-is, but file a new issue so that we don't forget about it before the next release.

Copy link
Member

@matthewrobertson matthewrobertson left a comment

Choose a reason for hiding this comment

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

LGTM!

@jskeet jskeet merged commit af9f09d into GoogleCloudPlatform:main Feb 16, 2022
@jskeet jskeet deleted the reformat-pubsub branch February 16, 2022 07:46
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

Successfully merging this pull request may close these issues.

Fix local development with Pub/Sub Emulator
3 participants