Troubleshooting

Subscription issues

Cannot create a subscription

Check that you have done all of the following:

  • Specified a subscription name in the name field. For version v1beta2 and above, the subscription name must be in the form projects/project-identifier/subscriptions/subscription-name.
  • Specified the name of an existing topic to which you want to subscribe, in the topic field. For version v1beta2 and above, the topic name must be in the form projects/project-identifier/topics/topic-name.
  • Specified https://, in lower case, not http:// or HTTPS:// as the protocol for your receiving URL in the pushEndpoint field.

Push subscriber not receiving any messages

Check the following:

  • Look in Cloud Monitoring for errors related to the subscription in question.
  • On Google App Engine, we recommend that you use the /_ah/push-handlers/ prefix in the endpoints URL path, as described in Registering App Engine endpoints. This allows the endpoint to receive push messages from Google Cloud Pub/Sub.
  • In other environments, make sure that your endpoint URL can be accessed from the Internet without requiring sign-in. You can check that the URL is not restricted by accessing it with a diagnostic tool such as cURL.
  • For domains other than appspot.com, make sure to register the domain in the Google Cloud Platform Console. See Registering other endpoints for details.

Other issues

SocketTimeoutException when pulling messages

In most cases, this is caused by the default timeout (20 seconds) in the Java client library. Cloud Pub/Sub requires a longer timeout if you're using hanging pull calls (i.e., req.setReturnImmediately(false)), so it is recommended that you explicitly set a longer timeout. Refer to the RetryHttpInitializerWrapper class for setting a longer timeout.

403 (Forbidden) error

If you get this error, do the following:

  • Make sure you've enabled the Google Cloud Pub/Sub API in the Cloud Platform Console.
  • Make sure that the principal making the request has the required permissions on the relevant Google Cloud Pub/Sub resources, especially if you are using Google Cloud Pub/Sub for cross-project communication.
  • If you're using Dataflow, make sure that both <projectId>@cloudservices.gserviceaccount.com and the Compute Engine Service account <projectId>-compute@developer.gserviceaccount.com have the required permissions on the relevant Google Cloud Pub/Sub resource. See Google Cloud Dataflow Security and Permissions for more information.
  • If you're using App Engine, check your project's Permissions page to see if an App Engine Service Account listed as an Editor. If it is not, add your App Engine Service Account as an Editor. Normally, the App Engine Service Account is of the form <project-id>@appspot.gserviceaccount.com.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Pub/Sub Documentation