-
Notifications
You must be signed in to change notification settings - Fork 3.9k
-
Hello,
I Tried to add the codes to cloud function for crashlytics alert system.
I defined env variable for Discord Webhook.
But it does not work. There is no log message. So, I guess there is a problem with reaching Crashlytics.
What can be the problem?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
If you're not seeing logs or Crashlytics alerts, the issue might be in several places - either in your code, environment variables, or even Crashlytics settings.
Debugging Steps:
-
Logging: Insert debug logs throughout your Cloud Function to trace the flow.
console.log("Function started");
-
Environment Variables: Make sure the environment variable for the Discord Webhook is correctly set up and accessible within your function.
console.log(process.env.YOUR_DISCORD_WEBHOOK_ENV_VARIABLE);
-
Permissions: Make sure your Cloud Function has the proper permissions to interact with Crashlytics.
-
Crashlytics Setup: Ensure Crashlytics is correctly set up to send alerts.
-
Manual Trigger: Try to manually trigger the Crashlytics alert to check if the problem is with Crashlytics or your Cloud Function.
-
Firebase Function Logs: Check the Firebase dashboard for logs regarding your function.
Here is a skeleton example to debug:
exports.myFunction = functions.https.onRequest((request, response) => { console.log("Function started"); console.log(`Discord Webhook: ${process.env.DISCORD_WEBHOOK}`); // Your code here console.log("Function ended"); });
This way, you can trace the function's execution and identify any issues.
Beta Was this translation helpful? Give feedback.