-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Creates eventarc channel in before deploying custom event function #5226
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure the channel didn't come with a project ID from the container contract. Do we need to normalize the channel that we get from functions.yaml into a full resource name? If so, where does that happen?
operationResourceName: op.name, | ||
}); | ||
} catch (err: any) { | ||
if (err.status === 409) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment that we get a CONFLICT because the channel has been created already and therefore we don't need to worry about the channel already existing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: channel normalization, I believe the normalization happens here: https://github.com/firebase/firebase-tools/blob/master/src/deploy/functions/runtimes/discovery/v1alpha1.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and yes agreed about adding a comment
src/gcp/eventarc.ts
Outdated
* Creates a channel. | ||
*/ | ||
export async function createChannel(channel: Channel): Promise<Operation> { | ||
const body: Partial<Channel> = cloneDeep(channel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We needed to clone into a Partial<Channel>
because we previously deleted the name. Now that we're not doing this we don't need to clone the body or use partial types.
); | ||
}); | ||
|
||
it.only("handles already existing eventarc channels", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it.only
do rather than it
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I forgot to take that out, hadn't cleaned up the PR before creating the draft!
If some unit tests are specified with it.only
, only they will run when the npm run test
command is executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits for you, thanks for sending!
Codecov ReportBase: 56.35% // Head: 56.37% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5226 +/- ##
==========================================
+ Coverage 56.35% 56.37% +0.02%
==========================================
Files 312 313 +1
Lines 21017 21049 +32
Branches 4271 4275 +4
==========================================
+ Hits 11844 11867 +23
- Misses 8147 8157 +10
+ Partials 1026 1025 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Some customers were experiencing deployment failures while attempting to deploy custom event triggered functions using the
onCustomEventPublished
providers (#5153).Our hypothesis is that the customer was attempting to deploy the custom event function before creating the Eventarc channel on which the function would be listening for events, and as a result, GCF threw an error back at the customer.
This PR patches the missing Eventarc channel issue by: