Cannot create a subscription
Check that you have done all of the following:
- Specified a subscription name in the
namefield. For version v1beta2 and above, the subscription name must be in the form
- Specified the name of an existing topic to which you want to subscribe, in the
topicfield. For version v1beta2 and above, the topic name must be in the form
https://, in lower case, not
HTTPS://as the protocol for your receiving URL in the
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.
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 GCP 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.comand the Compute Engine Service account
<projectId>-firstname.lastname@example.org 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