What is the maximum limit of Google Pub/Sub Attributes value? - google-cloud-pubsub

I'm trying to use Google Pub/Sub in my project.
And I got error because it exceed the limit of attributes value.
Message: Client error: POST https://pubsub.googleapis.com/v1/projects/<project>/topics/<topic>:publish resulted in a 400 Bad Request response: { "error": { "code": 400, "message": "One of the attributes in the request has a value that is too long. The l (truncated...)
I read the documentation on https://cloud.google.com/pubsub/docs/ but couldn't find it.

The limits are specified in the Quotas sections of the documentation. An attribute key can be up to 256 bytes and an attribute value can be up to 1024 bytes.

Related

Snowflake Unsupported Grant Type

I'm running into an issue trying to execute a Token Request for OAuth in Snowflake.
I'm using Postman with a query param of grant_type=authorization_code but the oauth token-request endpoint continually sends back the following response.
{
"data": null,
"error": "unsupported_grant_type",
"code": null,
"message": "The provided grant type is not supported.",
"success": false,
"headers": null
}
Any ideas? Per the documentation this is one of the two supported grant types.
https://docs.snowflake.com/en/user-guide/oauth-custom.html
API URL :
https://example.com/oauth/token-request?grant_type=authorization_code&code=123&redirect_uri=https://localhost.com
The issue is that the Snowflake documentation is incorrect. I will be submitting a ticket to them to get it fixed.
The documentation indicates that you're supposed to include the items as query parameters; they belong in the POST body as per the standard, however.
The values for token generation should be passed under x-www-form-urlencoded section and there the following values should be passed:
redirect_uri
grant_type
code
Under the Header section, following should be passed:
Authorization
The value for this would be:
Basic <base 64 encoded value for clientid:client secret>
The encoded value can be generated from: https://www.base64encode.org or you may generate it using code.

Positive Scenario Usage of StatusReport google home trait

In Google documentation, they explained how to use "statusReport" trait for query intent when there is an error or exception occurred for a device. I'm facing issue while using it for success status without any exception. I tried sending the response with simple status as SUCCESS, Google Home is saying the response "Sorry Unable to reach device".
The response which I was sending:
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "devices": { "123": { "online": true, "status": "SUCCESS" } } } }
can anyone help me to solve this issue?
After looking at the code, it is clear that you’re not sending the correct & complete response of the StatusReport trait. Your response contains the online attribute but missing the currentStatusReport attribute (it is required as it defines the current error statuses of the associated device IDs). For more information, visit https://developers.google.com/assistant/smarthome/traits/statusreport?hl=en

User-rate limit exceeded 429 on specific domain

We are getting this error on the one domain we are accessing, with Java:
429 unknown
{
"code" : 429,
"errors" : [ {
"domain" : "usageLimits",
"message" : "User-rate limit exceeded. Retry after 2015-05-21T16:36:01.691Z",
"reason" : "rateLimitExceeded"
} ],
"message" : "User-rate limit exceeded. Retry after 2015-05-21T16:36:01.691Z"
}
We are pretty sure that we are not exceeding the User-rate limit (250 quotas) for that system. We are only doing read requests, which should count about 5 quotas each. We would expect a maximum quota usage from 150 quotas per second with what we do.
We are using an oauth2 service account to access user mailboxes.
If it occurs we are waiting for the "Retry after" date. But we are immediately getting the "User-rate limit exceeded" right after that date.
This domain is in argentinia. While when we run the code against another domain in the US, we are NEVER getting this error.

Better error message when missing required fields from request

When missing a required field currently ProtoRPC returns a message like this:
{
"error": {
"code": 400,
"errors": [
{
"domain": "global",
"message": "Error parsing ProtoRPC request (Unable to parse request content: Message CombinedContainer is missing required field api_key)",
"reason": "badRequest"
}
],
"message": "Error parsing ProtoRPC request (Unable to parse request content: Message CombinedContainer is missing required field api_key)"
}
}
Is it possible to provide a better error message? Ideally, "missing required field api_key" in this example.
According to the Google Code Issue Tracker and Github issues this was once being worked on. However, there does not appear to be any activity.
I'd greatly appreciate any solutions or workarounds.
As of today, the ProtoRPC still returns the same unraised error which makes it harder for one to return a customized error response.
A simple workaround is to make the Message fields optional and enforce the requirement constraint somewhere in the endpoint handler/method.
So instead of;
class Request(Message):
name = StringField(1, required=True)
Set 'name' as optional,
class Request(Message):
name = StringField(1)
The requirement constraint can then be enforced in the endpoint handler method by simple if statements OR by mapping these fields to a Datastore entity that requires these fields, hence will allow exception handling of BadValueError and return a more customized error response.
Example:
try:
account = Account(name=request.name)
account.put()
except BadValueError:
return Response(status=False, message='Missing field "name"')

Error when trying to get Google Drive File

I am getting an error when trying to get a Google Drive File using:
file = service.files().get(fileId=<googleDriveFileId>).execute()
The error is:
<HttpError 404 when requesting https://www.googleapis.com/drive/v2/files/0B6Cpn8NXwgGPQjB6ZlRjb21ZdXc?alt=json returned "File not found: 0B6Cpn8NXwgGPQjB6ZlRjb21ZdXc">
However, when I copy and paste that link directly in the browser like this:
https://www.googleapis.com/drive/v2/files/0B6Cpn8NXwgGPQjB6ZlRjb21ZdXc?alt=json
I get a different error:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit Exceeded. Please sign up",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit Exceeded. Please sign up"
}
}
I am no where even close to exceeding the daily limit, the console shows 0% usage.
I know the fileId is correct, I am using Google Picker to get the fileId.
Any ideas?
I have found elsewhere that this is known issue with Google Drive that they are working to resolve. They offer the following workaround that I have confirmed works.
Add the following to when building the picker:
enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
complete code:
var picker = new google.picker.PickerBuilder().
addView(view).
addView(uploadView).
setAppId("pressomatic").
setCallback(pickerCallback).
enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
build();
picker.setVisible(true);
This same workaround solves another problem I have posted about, when trying to upload to a specific folder with Google Picker using setParent on a DocsUploadView. You still add the same feature to the Picker, not the DocsUploadView, and everything works as it should.

Resources