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

Add support for failure policies #1734

Closed
mad-it opened this issue Oct 18, 2019 · 5 comments · Fixed by #1858
Closed

Add support for failure policies #1734

mad-it opened this issue Oct 18, 2019 · 5 comments · Fixed by #1858

Comments

@mad-it
Copy link

mad-it commented Oct 18, 2019

Currently its not supported to set retry policies in a firebase function. To enable retries, you have to go to the Google cloud console and enable retries.

This manual step makes the deployment non-idempotent.

There is an open issue + pull request for firebase-functions repository which add support for this feature on that side.
Issue: firebase/firebase-functions#425
Pull request: firebase/firebase-functions#482

I am creating this issue in here as a way to track progress on the missing feature for firebase-tools.

@samtstern
Copy link
Contributor

@mad-it thanks for filing this.

@merlinnot (based on firebase/firebase-functions#482 (comment)) or @joehan if you can lay out what needs doing in this repo I could contribute the missing CLI pieces.

@merlinnot
Copy link
Contributor

Sure thing.

There's an API design for this feature approved by the API Council: firebase/firebase-functions#425 (comment) with small changes: firebase/firebase-functions#425 (comment).

In short, I implemented everything that is needed to deliver this feature in firebase-functions, it was approved by @laurenzlong, but put on hold pending feature parity in firebase-tools. The implementation exposes __trigger.failurePolicy, which is equal to { retry: {} } or is unset. This matches the API specification of Cloud Functions: https://cloud.google.com/functions/docs/reference/rpc/google.cloud.functions.v1#failurepolicy.

In the API design you can find an information that optionally a boolean value must be accepted by this property, but this is handled by firebase-functions already and transformed to a canonical representation { retry: {} }, so you don't need to worry about it.

The most complex part seems to be user prompts when changing these policies. You'd need to compare existing deployment with a new one. All of the possibilities, both in interactive and non-interactive shells, with and without --force flag are described in the original design linked above.

Let me know if anything is unclear and thank you soooo so much for picking it up!

@laurenzlong
Copy link
Contributor

Thanks for the helpful summary @merlinnot ! @samtstern happy to review the PR for CLI.

@samtstern samtstern self-assigned this Dec 10, 2019
@samtstern
Copy link
Contributor

I am working on this now, running into some strange issues with the Cloud Functions REST API but hoping to get them resolved soon

@samtstern
Copy link
Contributor

Syntax support for this feature is included in firebase-functions version 3.10.0 and the next version of firebase-tools will contain the necessary deployment pieces.

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

Successfully merging a pull request may close this issue.

4 participants