Firebase Google cloud pubsub topic name convention

55 Views Asked by At

Is there any topic naming convention since i have been trying to name my topic "googleDriveSync" and it doesnt work for example call to await pubsub.topic("googleDriveSync").exists(); throws an error but as soon as i add for example "myGoogleDriveSync" prefix to a topic name it works as expected

1

There are 1 best solutions below

0
samthecodingman On BEST ANSWER

Per the Google Cloud Pub/Sub Documentation on resource names:

Guidelines to name a topic, subscription, schema, or snapshot

A Pub/Sub resource name uniquely identifies a Pub/Sub resource, such as a topic, subscription, schema or snapshot. The resource name must fit the following format:

projects/project-identifier/collection/ID

  • project-identifier: Must be the project ID or project number, available from the > Google Cloud console. For example, my-cool-project is a project ID. 123456789123 is a project number.

  • collection: Must be one of topics, subscriptions, schemas, or snapshots.

  • ID: Must conform to the following guidelines:

    • Not begin with the string goog
    • Start with a letter
    • Contain between 3 and 255 characters
    • Contain only the following characters: Letters [A-Za-z], numbers [0-9], dashes -, underscores _, periods ., tildes ~, plus signs +, and percent signs %

You can use the special characters in the preceding list in resource names without URL-encoding. However, you must ensure that any other special characters are properly encoded or decoded when you use them in URLs. For example, mi-tópico is an invalid ID. However, mi-t%C3%B3pico is valid. This format is important when you make REST calls.

As above, you inadvertently broke the "Not begin with the string goog" rule.