-
Notifications
You must be signed in to change notification settings - Fork 58
Support Params as inputs in eventTrigger #168
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
The api of the manifest changed in firebase-functions@3.23. Some inputs have been updated to be `T | Expression<T>`.
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.
Curious to hear from @Berlioz
@@ -47,7 +47,7 @@ | |||
"@types/mocha": "^5.2.7", | |||
"chai": "^4.2.0", | |||
"firebase-admin": "^10.1.0", | |||
"firebase-functions": "^3.22.0", | |||
"firebase-functions": "^3.23.0", |
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.
Should we update the peer-depdency? It looks like our package won't work unless you are using firebase-functions 3.23 or above now since we explicitly try to import the Expression type in v2/params.
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.
You're extremely right!!!
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.
That probably means we need to do a minor or major bump then... WDYT?
@@ -1,4 +1,5 @@ | |||
import { CloudEvent, CloudFunction } from 'firebase-functions/v2'; | |||
import { Expression } from 'firebase-functions/v2/params'; |
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.
Aside - we are planning to change the import path of Expression from v2/params
to just /params
.
I wonder if there are more "elegant' way to import the type to avoid having this problem 🤔
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.
When is the change going to occur? 🙃
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.
v4 sdk!
if (typeof stringOrExpression === 'string') { | ||
return stringOrExpression; | ||
} | ||
return stringOrExpression?.value(); |
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.
Probably double check with @Berlioz - but I thought it is very possible that this to return empty string.
I'm wondering if we should think more about supporting Params firebase-functions.
Params are a way to specify "value of this is going to be determined at deploy time" - so it is probably going to be undefined at test time unless there is some special override mechanism.
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.
The problem I was working against was eventTrigger.eventFilters
and eventTrigger.eventFilterPathPatterns
were converted to type Record<string, string | Expression<string>>
:|
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.
The tests show a scenario where its populated at runtime too
The api of the manifest changed in firebase-functions@3.23. Some inputs have been updated to be
T | Expression<T>
.Description
The api of the manifest changed in firebase-functions@3.23. Some inputs have been updated to be
T | Expression<T>
.Code sample