Risolvere i problemi relativi a una sottoscrizione push
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Gli abbonati push sono un tipo di sottoscrittori Pub/Sub in cui i messaggi vengono inviati da Pub/Sub a un endpoint HTTPS specificato dall'utente. L'utente conferma un messaggio inviato restituendo una risposta HTTP 200 alla richiesta del server push. Questo documento fornisce alcuni suggerimenti comuni per la risoluzione dei problemi relativi agli abbonamenti push Pub/Sub. Scopri di più sulle iscrizioni push nella Guida per abbonati push.
Se l'endpoint restituisce un codice di risposta di errore, l'invio del messaggio viene considerato non riuscito e viene riprovato in un secondo momento. Ciò può potenzialmente portare all'invio di messaggi duplicati all'endpoint.
Esistono diverse metriche che puoi utilizzare per monitorare le iscrizioni push. La metrica subscription/push_request_count in Cloud Metrics classifica le risposte dall'endpoint push in base a response_code e response_class. Le risposte sono utili per identificare potenziali malfunzionamenti dell'endpoint. Se questa metrica contiene dati con un response_class diverso da ack, significa che l'endpoint push restituisce errori a Pub/Sub. Ecco alcuni degli errori più comuni:
Una classe di risposta deadline_exceeded indica che l'endpoint push non ha risposto entro la scadenza richiesta per l'acknowledgment (ack). La metrica subscription/push_request_latencies consente di monitorare la latenza dell'acknowledgement push.
Una classe di risposta invalid indica che l'endpoint ha restituito una risposta che Pub/Sub non è stato in grado di comprendere o elaborare correttamente.
Una classe di risposta remote_server_4xx in genere indica problemi di autenticazione o autorizzazione. Si tratta di codici di risposta HTTP restituiti dall'endpoint, quindi esamina gli scenari in cui viene restituito questo codice di risposta. Se l'autenticazione è attivata, verifica che il tuo account disponga dell'autorizzazione corretta per l'endpoint. Scopri di più su come funziona l'autenticazione nelle iscrizioni push.
Una classe di risposta remote_server_5xx indica un problema lato server dell'endpoint. L'endpoint non è in grado di elaborare la richiesta. Il problema potrebbe essere dovuto a una manutenzione o un'interruzione in corso. Controlla lo stato del server che ospita l'endpoint.
Una classe di risposta unreachable indica che il server endpoint non è raggiungibile. Verifica che l'URL dell'endpoint non presenti errori ortografici.
Restrizioni agli abbonamenti push all'interno di un perimetro VPC-SC
Se in un progetto è attiva la protezione di Controlli di servizio VPC (VPC-SC), esistono limitazioni alla creazione di iscrizioni push. Le iscrizioni push esistenti continuano a funzionare, ma quando ne crei una nuova viene visualizzato l'errore Request is prohibited by organization's policy. Nello specifico, i nuovi abbonamenti push possono essere creati solo se l'endpoint push è un servizio Cloud Run che utilizza l'URL run.app predefinito. Per ulteriori dettagli e limitazioni specifiche, consulta la documentazione di Pub/Sub e la documentazione di VPC-SC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Troubleshooting a push subscription\n\nPush subscribers are a type of Pub/Sub subscriber where messages are sent from Pub/Sub to a user-specified HTTPS endpoint. The user acknowledges a pushed message by returning an HTTP 200 response to the push server's request. This document provides some common troubleshooting tips for Pub/Sub push subscriptions. Read more about push subscriptions in the [Push subscriber guide](/pubsub/docs/push).\n\nTo effectively monitor your Pub/Sub subscription, it is recommended to first look at the [delivery latency health score](/pubsub/docs/monitoring#delivery_latency_health) ([`subscription/delivery_latency_health_score`](/monitoring/api/metrics_gcp_p_z#pubsub/subscription/delivery_latency_health_score)) to check which factors could be contributing to an unexpected latency.\n\nFailing or slow push endpoints\n------------------------------\n\nIf the endpoint returns an error response code, then the message delivery is considered to have failed and is retried later. This can potentially lead to the endpoint receiving duplicate messages.\n\nThere are multiple metrics that you can use to [monitor push subscriptions](/pubsub/docs/monitoring#monitoring_push_subscriptions). The [`subscription/push_request_count`](/monitoring/api/metrics_gcp_p_z#pubsub/subscription/push_request_count) metric in Cloud Metrics categorizes responses from the push endpoint by `response_code` and `response_class`. The responses are useful for the identification of potential endpoint malfunctions. If this metric has data with a `response_class` other than `ack`, this indicates that the push endpoint is returning errors to Pub/Sub. Some of the most common errors include:\n\n- A `deadline_exceeded` response class indicates that the push endpoint didn't respond within the required acknowledgment (ack) deadline. The [`subscription/push_request_latencies`](/monitoring/api/metrics_gcp_p_z#pubsub/subscription/push_request_latencies) metric helps to track push ack latency.\n\n- An `invalid` response class indicates that the endpoint sent back a response that Pub/Sub couldn't understand or process correctly.\n\n- A `remote_server_4xx` response class usually indicates authentication or permission issues. These are HTTP response codes returned by the endpoint, so look at the scenarios under which this response code is returned. If authentication is enabled, confirm your account has the right permission on the endpoint. Learn more about how [authentication](/pubsub/docs/create-push-subscription#authentication) works in push subscriptions.\n\n- A `remote_server_5xx` response class indicates a server-side problem on the endpoint side. The endpoint is unable to process the request. This might be due to an ongoing maintenance or outage. Review the status of the server hosting the endpoint.\n\n- An `unreachable` response class indicates that the endpoint server cannot be reached at all. Verify the endpoint URL for typos.\n\nLearn more about the most common [error codes](/pubsub/docs/reference/error-codes) of the Pub/Sub API.\n\nRestrictions on push subscriptions inside a VPC-SC perimeter\n------------------------------------------------------------\n\nIf VPC Service Controls (VPC-SC) protection is enabled in a project, there are limitations on creating push subscriptions. Existing push subscriptions continue to work, but when you create a new push subscription, you see the error: `Request is prohibited by organization's policy`. Specifically, new push subscriptions can only be created if the push endpoint is a Cloud Run service using the default `run.app` URL. For more details and specific limitations, see [Pub/Sub documentation](/pubsub/docs/create-push-subscription#vpc-service-control) and [VPC-SC documentation](/vpc-service-controls/docs/supported-products#table_pubsub)."]]