admin管理员组文章数量:1321070
I made a firebase function and defined a pub/sub trigger:
google_play_purchase_handler.py
:
@pubsub_fn.on_message_published(topic=GOOGLE_PLAY_PUBSUB_TOPIC, region=REGION)
async def handle_server_event(self, event: pubsub_fn.CloudEvent[pubsub_fn.MessagePublishedData]):
try:
event = json.loads(event.data.message.decode("utf-8"))
except json.JSONDecodeError as e:
logging.error(f"Could not parse Google Play billing event: {e}")
return
purchase_token = event.get("subscriptionNotification", {}).get("purchaseToken") or \
event.get("oneTimeProductNotification", {}).get("purchaseToken")
product_id = event.get("subscriptionNotification", {}).get("subscriptionId") or \
event.get("oneTimeProductNotification", {}).get("sku")
product_data = product_data_map.get(product_id)
if not product_data:
return
if product_data["type"] == "SUBSCRIPTION":
await self.handle_subscription(None, product_data, purchase_token)
elif product_data["type"] == "NON_SUBSCRIPTION":
await self.handle_non_subscription(None, product_data, purchase_token)
.....
In main.py:
from google_play_purchase_handler import GooglePlayPurchaseHandler
handle_google_server_event = GooglePlayPurchaseHandler.handle_server_event
i ran firebase deploy
and it was successful.
However when I checked in the Firebase console, it says the trigger is unknown:
I created the pub/sub topic on google cloud, set the proper permissions to the topic and added it in Google Play(at monetization setup option).
本文标签: google cloud functionsFirebase gen2 unkown trigger despite successful deploymentStack Overflow
版权声明:本文标题:google cloud functions - Firebase gen2: unkown trigger despite successful deployment - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742092266a2420338.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论