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

Getting the "task was cancelled" error #337

Open
jesualdo13 opened this issue Dec 27, 2022 · 2 comments
Open

Getting the "task was cancelled" error #337

jesualdo13 opened this issue Dec 27, 2022 · 2 comments

Comments

@jesualdo13
Copy link

Environment

  • Operating System version: Windows (Azure instance)
  • Firebase SDK version: 2.3.0
  • Firebase Product: FirebaseAdmin
  • .NET version: 3.1 (net core)

Description of the problem:

I'm using FirebaseAdmin (nuget) to send some push notification inside an Azure function. In the local environment it's working perfectly, the SDK is returning the PUSH notifications IDs, but when I run it in a PRIVATE Azure plan, the SDK returns the following error:

"A task was cancelled".

That's all. There's is no other message or stack.

Steps to reproduce:

I don't know. I think this is a firewall blocking but I need more logs from the SDK to be completely sure.

Relevant Code:

try
            {
               
                logger.LogInformation("NS. Step 1. Firebase configuration credentials: " + _messageConfig);

                var fcm = FirebaseAdmin.Messaging.FirebaseMessaging.GetMessaging(app);

                logger.LogInformation("NS. Step 2. Firebase Messaging instance creates: " + _messageConfig);

                Message message = new Message()
                {
                    Data = new Dictionary<string, string>
                    {
                        {"OrderNbr",pushNotification.OrderNbr},
                        {"CdNbr", pushNotification.CdNbr.ToString()},
                        {"StoreNbr",pushNotification.StoreNbr.ToString()},
                        {"type",pushNotification.type.ToString()}

                },
                    Notification = new FirebaseAdmin.Messaging.Notification
                    {

                        ImageUrl = "https://firebasestorage.googleapis.com/v0/b/lookapp-dev-77465.appspot.com/o/LOOK_APP_little.jpg?alt=media&token=3eadd967-f158-4ad8-8469-62a1fad91311",
                        Title = pushNotification.title,
                        Body = pushNotification.description
                    },
                    Token = String.IsNullOrEmpty(pushNotification.deviceTokenAndroid) ? pushNotification.deviceTokenIOS : pushNotification.deviceTokenAndroid
                };

                logger.LogInformation("NS. Step 3. Message created, sending....");

                var result = fcm.SendAsync(message);

                logger.LogInformation("NS. Step 4. Result from firebase (notification id):" + result.Result);
                return result.Id;
                
            }
            catch (Exception ex)
            {
                logger.LogError(ex, $"Error sending firebase message");
                throw;
            }

Notes

I just want to know what kind of issue produces this error.
Should I manage the firewall to enable any URL?

Thanks in advance

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@AliEasy
Copy link

AliEasy commented Dec 23, 2023

Any solution on this?

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

No branches or pull requests

3 participants