Firebase admin proxy issue
See original GitHub issueNote: my firebase code is running on container behind the proxy and in my code i am configurating it like in image below .
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](Task
1 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(IEnumerable
1 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(IEnumerable
1 messages, Boolean dryRun, CancellationToken cancellationToken)\n at FirebaseAdmin.Messaging.FirebaseMessaging.SendAllAsync(IEnumerable1 messages, Boolean dryRun, CancellationToken cancellationToken)\n at FirebaseAdmin.Messaging.FirebaseMessaging.SendAllAsync(IEnumerable
1 messages, Boolean dryRun)\n at FirebaseAdmin.Messaging.FirebaseMessaging.SendAllAsync(IEnumerable1 messages)\n at PushNotificationsService.FirebaseHandler.FirebaseMessageComposer.SendMessageBatch(List
1 messages) in /opt/app-root/src/Pu
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
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-fe46658b5f2aYou need to pass your
ProxyHttpClientFactory
toGoogleCredential
as well. See the example I referenced above.