Problem: The optional context.auth.uid is expected to be part of the parameters of a firebase trigger, but is not being provided.
I am writing a document onCreate trigger on Firebase Cloud Functions. This trigger will write a sub-collection document using some of the data from the triggering document and the UID of the user who created it.
A standard trigger function will accept the following
export const onCreateUnit = functions.firestore.document('/units/{unitId}').onCreate((snap, context) => {
The context object should include an auth object which would contain the uid and token
context: {
...contextProperties,
auth: {
uid: XXXXXX-XXXX-XXXX,
token: YYYYYYYYYYY
}
}
Some things to keep in mind.
Why is there no auth property provided in the context? How can I fix it?
看起来您没有提供从前端到在一起的数据,请检查您的用户是否已经登录,这发生在我身上几次。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.