You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Me and my team have been trying to implement the web push notifications with our .NET 6 backend.
When ran on localhost, everything works perfectly. Pushing and receiving a notification works like a charm.
However, when we deploy our application to Azure, we run into trouble.
We've set the .env variables in the configuration of our app in Azure configuration,
but an error 410
Subscriptionno longer valid. Details: push subscription has unsubscribed or expired.
is thrown.
The weird thing is, when we use the same keypair and subscriber credentials in our local development, the notification gets sent and actually gets received in the Azure deployed React app. Even if we set our launchSettings.json to be production.
Some sources online suggest that a subscription might change over time, but this does not explain the fact that it does go through locally and doesn't when deployed. Why is this happening? Are we missing some kind of (deployment-)configuration?
For reference, here are some configs/files that we use:
appsettings.Development.json (keys were generated with the VapidHelper.GenerateVapidKeys(); method)
asyncprivateTaskSendNotification(List<NotificationCredential>devices,stringpayload){stringvapidPublicKey=_configuration["VapidKeys:PublicKey"];stringvapidPrivateKey=_configuration["VapidKeys:PrivateKey"];Console.WriteLine(vapidPublicKey);Console.WriteLine(vapidPrivateKey);// both in development AND in production these keys are printed!varwebPushClient=newWebPushClient();varvapidDetails=newVapidDetails("mailto:[email protected]",vapidPublicKey,vapidPrivateKey);foreach(vardeviceindevices){varpushSubscription=newPushSubscription(device.Endpoint,device.P256dh,device.Auth);awaitwebPushClient.SendNotificationAsync(pushSubscription,payload,vapidDetails);}}
The text was updated successfully, but these errors were encountered:
Me and my team have been trying to implement the web push notifications with our .NET 6 backend.
When ran on localhost, everything works perfectly. Pushing and receiving a notification works like a charm.
However, when we deploy our application to Azure, we run into trouble.
We've set the
.env
variables in the configuration of our app in Azure configuration,but an error 410
is thrown.
The weird thing is, when we use the same keypair and subscriber credentials in our local development, the notification gets sent and actually gets received in the Azure deployed React app. Even if we set our
launchSettings.json
to be production.Some sources online suggest that a subscription might change over time, but this does not explain the fact that it does go through locally and doesn't when deployed. Why is this happening? Are we missing some kind of (deployment-)configuration?
For reference, here are some configs/files that we use:
appsettings.Development.json (keys were generated with the
VapidHelper.GenerateVapidKeys();
method)The text was updated successfully, but these errors were encountered: