Implementation of subscriptions and example value for iap.google.notifications_endpoint_id

Hi Sesposito, thanks for your previous answer. I’ve been trying different things on and off but alas, no success.

I’ve been doing that as far as I know by passing the startup parameter “–logger.level DEBUG” and no message is ever triggered related to subscription renewals. I’ve also ran Nakama from source code and added additional log messages in core_subscription.go, in **"func googleNotificationHandler(logger *zap.Logger, db sql.DB, config IAPGoogleConfig) http.HandlerFunc {" to be more precise.

Unlike before, I am now very confident my setup on Google’s side is correct as I can read notifications from the subscription using the following code:

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"cloud.google.com/go/pubsub"
)

func main() {
	// Set your Google Cloud project ID and Pub/Sub subscription name
	projectID := "YOUR PROJECT ID"
	subscriptionName := "YOUR SUBSCRIPTION NAME"

	ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
	defer cancel()

	// Create a new Pub/Sub client
	client, err := pubsub.NewClient(ctx, projectID)
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}
	defer client.Close()

	// Get a handle for the specified subscription
	sub := client.Subscription(subscriptionName)

	// Receive messages and print them to the console
	err = sub.Receive(ctx, func(ctx context.Context, msg *pubsub.Message) {
		fmt.Printf("Received message: %s\n", msg.Data)
		msg.Ack()
	})
	if err != nil {
		log.Fatalf("Failed to receive messages: %v", err)
	}
}

To anyone that finds this code useful to test your Google backend setup you’ll have to create an environment variable pointing to your .json credentials. In a Mac this would be done with:

export GOOGLE_APPLICATION_CREDENTIALS="/Path/to/your/google/applications/credentials/appname-80122638-12431ff11581.json"

From this I’m concluding the setup on Google’s side is done correctly as I can see the notifications of the events being renewed, however the same doesn’t happen within Nakama. The expiry date displayed in the Nakama console is never updated (Neither are the additional debug logs I added directly to the source code).

I also tried to pass the contents of my .json credentials through the startup commands when starting Nakama, with the “–google_auth.credentials_json=” parameter. I made sure to add ““redirect_uris”: [“urn:ietf:wg:oauth:2.0:oob”]” to the json content as explained in this forum post. Not sure what that does or even why we need to add it manually, heck, I don’t even know what exactly to add between the square braces, there’s simply no documentation that I can find that explains this process step by step. It’s extremely frustrating to say the least.

At this point I’m stuck, not sure where to move or even what else to try to receive the notifications within Nakama.

Any help or direction would be greatly appreciated. :pray: