question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firebase admin proxy issue

See original GitHub issue

Note: my firebase code is running on container behind the proxy and in my code i am configurating it like in image below .

image

Note: I used curl command to send notification using proxy and it works like a charm

but firebase admin code gives this error

{“EntryDate”:“Fri Jun 28 09:34:42 +00:00 2019”,“Level”:“ERROR”,“Message”:{“body”:"FirebaseAdmin.FirebaseException: Error while calling the FCM service. —> System.Net.Http.HttpRequestException: No such device or address —> System.Net.Sockets.SocketException: No such device or address\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\n — End of inner exception stack trace —\n at Google.Apis.Http.ConfigurableMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\n at Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.ExecuteAsync(TokenRequest request, HttpClient httpClient, String tokenServerUrl, CancellationToken taskCancellationToken, IClock clock)\n at Google.Apis.Auth.OAuth2.ServiceAccountCredential.RequestAccessTokenAsync(CancellationToken taskCancellationToken)\n at Google.Apis.Auth.OAuth2.TokenRefreshManager.RefreshTokenAsync()\n at Google.Apis.Auth.OAuth2.TokenRefreshManager.ResultWithUnwrappedExceptions[T](Task1 task)\n at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()\n at System.Threa

| ding.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)\n— End of stack trace from previous location where exception was thrown —\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)\n— End of stack trace from previous location where exception was thrown —\n at Google.Apis.Auth.OAuth2.TokenRefreshManager.GetAccessTokenForRequestAsync(CancellationToken cancellationToken)\n at Google.Apis.Auth.OAuth2.ServiceAccountCredential.GetAccessTokenForRequestAsync(String authUri, CancellationToken cancellationToken)\n at Google.Apis.Auth.OAuth2.ServiceCredential.InterceptAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n at Google.Apis.Http.ConfigurableMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\n at Google.Apis.Requests.BatchRequest.ExecuteAsync(CancellationToken cancellationToken)\n at FirebaseAdmin.Messaging.FirebaseMessagingClient.SendBatchRequestAsync(IEnumerable1 messages, Boolean dryRun, CancellationToken cancellationToken)\n at FirebaseAdmin.Messaging.FirebaseMessagingClient.SendAllAsync(IEnumerable1 messages, Boolean dryRun, CancellationToken cancellationToken)\n --- End of inner exception stack trace ---\n at FirebaseAdmin.Messaging.FirebaseMessagingClient.SendAllAsync(IEnumerable1 messages, Boolean dryRun, CancellationToken cancellationToken)\n at FirebaseAdmin.Messaging.FirebaseMessaging.SendAllAsync(IEnumerable1 messages, Boolean dryRun, CancellationToken cancellationToken)\n at FirebaseAdmin.Messaging.FirebaseMessaging.SendAllAsync(IEnumerable1 messages, Boolean dryRun)\n at FirebaseAdmin.Messaging.FirebaseMessaging.SendAllAsync(IEnumerable1 messages)\n at PushNotificationsService.FirebaseHandler.FirebaseMessageComposer.SendMessageBatch(List1 messages) in /opt/app-root/src/Pu

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
hiranya911commented, Jun 28, 2019

It’s the GoogleCredential that is failing to connect to the remote server. You have to also pass your proxy configuration to the credential. See the example at https://medium.com/google-cloud/accessing-google-cloud-apis-though-a-proxy-fe46658b5f2a

1reaction
hiranya911commented, Jul 1, 2019

You need to pass your ProxyHttpClientFactory to GoogleCredential as well. See the example I referenced above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to connect to Firebase by Firebase Admin against a ...
Prepare a proxy server that allows you to access Google services, then · Install the https-proxy-agent package through npm or yarn, then ·...
Read more >
proxy via httpAgent does not work on firebase-admin^8 #870
Looks like an issue with the proxy server itself. The SDK has clearly passed the http.Agent to the Node.js HTTP API. The same...
Read more >
Setup Firebase Admin SDK Behind Proxy Network | by Tek Loon
This article is related to how I setup Firebase Admin Nodejs SDK under proxy network. Problem Statement. I am working in a corporate...
Read more >
Firebase Admin Node.js SDK Release Notes - Google
Firebase Admin Node.js SDK Release Notes ... Fixed a caching issue in the Cloud Firestore API when initialized with the preferRest setting to...
Read more >
Add the Firebase Admin SDK to your server - Google
Set up a Firebase project and service account. To use the Firebase Admin SDK, you'll need the following: A Firebase project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found