Reputation: 48
I'm trying to set an expiration time for a subscription.
This is how options looks like as suggested by the official docs:
https://cloud.google.com/nodejs/docs/reference/pubsub/0.28.x/global#CreateSubscriptionRequest https://cloud.google.com/nodejs/docs/reference/pubsub/0.28.x/global#ExpirationPolicy
let options = {
expirationPolicy: {
ttl: '86400s',
},
};
Then I got .google.pubsub.v1.ExpirationPolicy.ttl: object expected
error.
So I tried having an object inside property ttl
then I got the following error: The value for 0 is too small. You passed expiration duration in the request, but the minimum value is 24h.
I'm unable to find the correct format to this.
I'm on @google-cloud/[email protected] and tried upgrading to @google-cloud/[email protected]. No luck.
Anyone has experienced this before or know the correct format for expirationPolicy
?
Upvotes: 2
Views: 2282
Reputation: 17251
The expirationPolicy
ttl
needs to be specified as an object with the seconds field as an integer:
let options = {
expirationPolicy: {
ttl: {
seconds: 86400
}
}
};
This is inconsistent with the documentation, so I have created a GitHub issue to track the inconsistency.
Upvotes: 8