Could you please help me with the issue that I have.
I'm using FirebaseAdmin .NET C# library to send notification to firebase server.
When it's trying to initialize the FirebaseAdmin with command FirebaseApp.Create (see code below) i got an error:
System.MissingFieldException: Field not found:
'Initializer.DefaultHandleUnsuccessfulResponseFunc'. at
FirebaseAdmin.Util.RetryOptions.get_Default() at
FirebaseAdmin.Messaging.FirebaseMessagingClient.Create(FirebaseApp
app) at FirebaseAdmin.Messaging.FirebaseMessaging..ctor(FirebaseApp
app) at
FirebaseAdmin.Messaging.FirebaseMessaging.<>c__DisplayClass5_0.b__0()
at FirebaseAdmin.FirebaseApp.GetOrInit[T](String id, ServiceFactory`1
initializer) at
EventNotifier.FirebaseNotifier.FirebaseMessageSender.d__4.MoveNext()
in
C:gitlab-runneruilds4bEsN_fPflEventNotifierEventNotifierFirebaseNotifierFirebaseMessageSender.cs:line
66
The code is working perfectly on other servers (Windows 10, Windows Server 2016). However, on current server (Windows Server 2016) I have this issue.
The code is below:
public class FirebaseAppClient
{
private static readonly object _syncRoot = new object();
private static FirebaseAppClient _instance;
private FirebaseAppClient()
{
if (FirebaseApp.DefaultInstance == null)
{
FirebaseApp = FirebaseApp.Create(new AppOptions()
{
Credential =
GoogleCredential.FromJson(
JsonConvert.SerializeObject(new FirebaseConfigProvider().GetConfiguration())),
});
}
else
{
FirebaseApp = FirebaseApp.DefaultInstance;
}
}
public static FirebaseAppClient GetInstance()
{
if (_instance == null)
{
lock (_syncRoot)
{
_instance = new FirebaseAppClient();
}
}
return _instance;
}
public FirebaseApp FirebaseApp { get; private set; }
}
Please help!
question from:
https://stackoverflow.com/questions/65890156/cant-initialize-firebaseadmin-because-of-field-not-found-initializer-default 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…