I'm attempting to update an existing sink using the (Python) Google Stackdriver Logging API, and am getting an error that I can't track down.
The API explorer for the method in question is here, to which I'm supplying projects/my_project/sinks/my_sink_name as the sinkName, and the following for the Request Body:
{
"name": "audit_logs",
"destination": "bigquery.googleapis.com/projects/my_project/datasets/destination_dataset",
"filter": "resource.type=\"bigquery_resource\""
}
When submitting, I get the following error:
400 Bad Request
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
...which doesn't specify which argument is invalid, and I have tried several variations without any success.
Additional info: this request is based on one generated by the Python API. I have also tried specifying the full path of the sink in name to no avail, which is what the Python API generates, which seems contrary to the documentation.
Can you try the UpdateSink with uniqueWriterIdentity set to true?
From https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update:
"It is an error if the old value is true and the new value is set to false or defaulted to false."
Related
I am trying to move resources from one resource group to another via Postman.
I got the access token successfully by using below parameters:
https://login.microsoftonline.com/mytenantid/oauth2/v2.0/token
client_id='myclientid'
&scope=https://management.azure.com/.default
&grant_type=client_credentials
&client_secret='appclientsecret'
I am using query like below:
POST
https://management.azure.com/subscriptions/mysubscriptionid/resourceGroups/resourcegroupname/moveResources?api-version=2021-04-01
Request Body
{
"resources" : "/subscriptions/mysubscriptionid/resourceGroups/resourcegroupname/providers/Microsoft.KeyVault/vaults/keyvaultname",
"targetResourceGroup" : "/subscriptions/mysubscriptionid/resourceGroups/targetresourcegroupname"
}
But I got error like below:
{ "error": { "code": "UnsupportedMediaType",
"message": "The content
media type 'text/plain' is not supported. Only 'application/json' is
supported."
} }
After changing the type to JSON, I am getting another error like below:
{ "error": { "code": "InvalidRequestContent", "message": "The request
content was invalid and could not be deserialized: 'Error converting
value
"/subscriptions/mysubscriptionid/resourceGroups/resourcegroupname/providers/Microsoft.KeyVault/vaults/keyvaultname"
to type 'System.String[]'. Path 'resources', line 2, position 143.'."
} }
Can anyone help me to resolve this error?
I tried to reproduce the same in my environment and was able to move resources successfully like below:
Make sure your request body is something like below:
{
"resources" : ["/subscriptions/XXXXXXX/resourceGroups/Test/providers/Microsoft.KeyVault/vaults/testkeyvault549","/subscriptions/XXXXXXXXX/resourceGroups/Test/providers/Microsoft.Storage/storageAccounts/sristackdem01"],
"targetResourceGroup" : "/subscriptions/XXXXXXX/resourceGroups/Demo"
}
When I executed the same query, I got below response:
Please note that resources parameter expects list of resource IDs in [ ]. So, make sure to add them.
When I missed giving [ ] as mentioned above, I got the same error as you like below:
Reference:
Validate Azure Resource Move with Postman - Apostolidis Cloud Corner
Background: I am building a cloud function using python to take a .csv uploaded to our bucket and upload its rows as entities into Datastore.
When trying to deploy the Python function, I got an error where the function would fail to deploy due to the following error code:
Build failed: {
"cacheStats": [{
"status": "MISS",
"hash": "SOME HASH",
"type": "docker_layer_cache",
"level": "global"
}, {
"status": "MISS",
"hash": "SOME HASH",
"type": "docker_layer_cache",
"level": "project"
}
]
}
To try to diagnose the problem, I attempted deploying a template Python function, and got the same error. (Code included below just in case)
def hello_world(request):
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.
"""
request_json = request.get_json()
if request.args and 'message' in request.args:
return request.args.get('message')
elif request_json and 'message' in request_json:
return request_json['message']
else:
return f'Hello World!'
From my understanding of the error, it implies that there is an issue with the hashing to my project specifically, but it is not clear to me how to fix this, or what resulted in this error occurring.
https://cloud.google.com/functions/docs/troubleshooting has no information about an error of this type, and other errors that I have seen similar to this error are due to situations such as the entry function parameters being incorrect, which is not the case here.
Cloud functions are running as normal according to google (https://status.cloud.google.com/).
Is this a genuine problem on google's end? Or is there some setting that I am not aware of that would have caused this issue?
Update: Node.js functions are working fine, python functions still do not work. In addition, Go functions result in an error where the logs fail on build step #5 due to Token exchange failed for project: 'project-id'
I'm trying to get insights for all the posts from one of my facebook pages. I tried out the expression below in graph explorer but i got an error. I managed to get insights for just one post using its id, but it doesn't seem to work when I want to get all the posts at once.
{page-id}/posts/?fields=insights{post_impressions_unique}
{
"error": {
"message": "Invalid query",
"type": "OAuthException",
"code": 3001,
"error_subcode": 1504028,
"is_transient": false,
"error_user_title": "No Metric Specified",
"error_user_msg": "No metric was specified to be fetched. Please specify one or more metrics to be fetched and try again.",
"fbtrace_id": "Ao79E5/rtfn"
}
}
Any ideas?
The /object-id/insights/metricname syntax does not translate into foo{bar} like other sub-fields, you need to use a slightly different syntax here:
?fields=insights.metric(post_impressions_unique)
I'm studying about Google Cloud Platform.
In this stackdriver projects.groups.members.list I'm trying to get member's list in stackdriver's group.
when I command this code in above link,I get this error.
GET https://monitoring.googleapis.com/v3/projects/{my_project}/groups/{my_group}/members?key={YOUR_API_KEY}
error :
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
my_project and my_group is correct, and there is no other argument, is there any problem?
I found that {my_group} is not alphabetical string like my_group,
but integer string like 12345678956.
in this projects.groups.list you can find your group_id by excuting APIs Explorer.
When i use GET /v2.4/{photo-id} in graph API explorer
It throws an error :
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: {user-id}",
"type": "OAuthException",
"code": 803
}
}
what does this really mean ? any help
You seem to be passing {user-id} which is not a valid data to query about.
Instead, use the below code without {user-id}:
GET /v2.4/{photo_id}
{photo_id} is an id of a post most probably in the userid_postid ("10000_00001") format.