Error uploading google action via gactions - actions-on-google

I created a project marvin-xyz, and a json action file marvin.json
When I try to upload it with the CIA tools from google: gactions,
I get the following error:
$gactions test --action_package marvin.json --project marvin-xyz
Pushing the app for the Assistant for testing...
ERROR: Failed to test the app for the Assistant
ERROR: Internal error encountered.
2017/09/28 10:35:28 Server did not return HTTP 200
xyz is just a placeholder here - the project exists - in both cases, the real one has been used
Any advice?
EDIT: here it the update with the verbose option
$gactions --verbose test --action_package marvin.json --project marvin-xyz
Checking for updates...
Successfully fetched update metadata
Finished checking for updates -- no updates available
Pushing the app for the Assistant for testing...
POST /v2/users/me/previews/marvin-xyz:updateFromAgentDraft?updateMask=previewActionPackage.actionPackage.actions%2CpreviewActionPackage.actionPackage.conversations%2CpreviewActionPackage.actionPackage.types%2CpreviewActionPackage.startTimestamp%2CpreviewActionPackage.endTimestamp HTTP/1.1
Host: actions.googleapis.com
User-Agent: Gactions-CLI/2.0.7 (darwin; amd64; stable/XYZ)
Content-Length: 697
Content-Type: application/json
Accept-Encoding: gzip
{"name":"users/me/previews/marvin-xyz","previewActionPackage":{"actionPackage":{"actions":[{"description":"Default Welcome Intent","fulfillment":{"conversationName":"marvin"},"intent":{"name":"actions.intent.MAIN","trigger":{"queryPatterns":[{"queryPatterns":"I want to talk to marvin"},{"queryPatterns":"talk to marvin"},{"queryPatterns":"wake up marvin"},{"queryPatterns":"is marvin there?"},{"queryPatterns":"where is marvin?"},{"queryPatterns":"hello marvin"},{"queryPatterns":"pass me to marvin"},{"queryPatterns":"marvin please"}]}},"name":"MAIN"}],"conversations":{"marvin":{"name":"marvin","url":"https://example.com/sidekick/api/v1/"}}},"name":"users/me/previews/marvin-xyz"}}
Reading credentials from: creds.data
ERROR: Failed to test the app for the Assistant
ERROR: Internal error encountered.
2017/09/29 23:37:09 Server did not return HTTP 200

Related

Jfrog file upload failing with 403 forbidden

I have been trying to upload a file into JFrog artifactory repo from the cli as below and keep getting the 403 Forbidden error. What am I missing as env variables, etc for the upload to go through from the cli?
jf rt u "xyz" --url="http://example.com/ui/repos/tree/General/asdf/cba" --username="afad" --password="********"
Log path: /home/asdf/.jfrog/logs/jfrog-cli.ss.ss.ss.log
[Info][Thread 2]Uploading artifact: xyz
[Warn][Thread 2](Attempt 1) - Failure occurred while uploading to http://example.com/ui/repos/tree/General/asdf/cba/--username=svc#esuk.com/xyz:
server response: 403 Forbidden
[Warn][Thread 2](Attempt 2) - Failure occurred while uploading to http://example.com/ui/repos/tree/General/asdf/cba/--username=svc#esuk.com/xyz:
server response: 403 Forbidden
[Warn][Thread 2](Attempt 3) - Failure occurred while uploading to http://example.com/ui/repos/tree/General/asdf/cba/--username=svc#esuk.com/xyz:
server response: 403 Forbidden
[Warn][Thread 2](Attempt 4) - Failure occurred while uploading to http://example.com/ui/repos/tree/General/asdf/cba/--username=svc#esuk.com/xyz:
server response: 403 Forbidden
[Info] [Thread 2] executor timeout after 3 attempts with 0 milliseconds wait intervals
[Error] server response: 403 Forbidden
[Error] Failed uploading 1 artifacts.
[Error] server response: 403 Forbidden
--username is not a valid argument and the target path is also missing. Use the below command to upload a file.
jf rt u "testfile.txt" "generic-local" --url="https://myartifactory.jfrog.io/artifactory" --user="youruser" --password="yourpassword"
This will upload a file called testfile.txt to the repository generic-local. If you want to deploy to a specific path, you can pass the path after generic-local.
jf rt u "testfile.txt" "generic-local/path1/subpath/" --url="https://myartifactory.jfrog.io/artifactory" --user="youruser" --password="yourpassword"

Send the Build status of an Azure DevOps Server pipeline via REST to Bitbucket

I'm trying to send the status of a build pipeline to Bitbucket Server after the build is successful/failed.
With Postman, I'm able to successfully update the build status of a commit with the REST API:
POST https://bitbucketserver/rest/build-status/1.0/commits/dac37f9ede70e9548528a1dd19409b352db624e6
204
177 ms
Warning: Self signed certificate in certificate chain
POST /rest/build-status/1.0/commits/dac37f9ede70e9548528a1dd19409b352db624e6 HTTP/1.1
Authorization: Basic eHhrbGk6MjlOb3ZlbWJlcjIwMjA=
Content-Type: application/json
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Postman-Token: e88d324b-e014-48e6-9a4c-5ad094e49aed
Host: nibcoderepo:7990
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 220
{
"state": "SUCCESSFUL",
"key": "Project",
"name": "CI-Build",
"url": "https://devops/Project/Repo/_build",
"description": "Build status from Azure Devops Server"
}
HTTP/1.1 204 No Content
However when I try to run the Invoke REST API in an agentless job in the pipeline, the request fails and is not able to find the server. Here's the output from the job log:
==============================================================================
Task : Post build status
Description : Invoke a REST API as a part of your pipeline.
Version : 1.152.1
Author : Microsoft Corporation
Help URL : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/http-rest-api
==============================================================================
Parsing expression: <TaskInputs[TaskInputs['connectedServiceNameSelector']]>
TaskInputs
[
..TaskInputs
..[
....'connectedServiceNameSelector'
..]
]
Evaluating: TaskInputs[TaskInputs['connectedServiceNameSelector']]
Evaluating indexer:
..Evaluating TaskInputs:
..=> Object
..Evaluating indexer:
....Evaluating TaskInputs:
....=> Object
....Evaluating String:
....=> 'connectedServiceNameSelector'
..=> 'connectedServiceName'
=> '3f2eef60-1c18-4d2d-95ef-20b9946e6a16'
Result: '3f2eef60-1c18-4d2d-95ef-20b9946e6a16'
POST https://bitbucketserver//rest/build-status/1.0/commits/b63a3c20f0b0df1fcaa163284f82e6efa9e84437
Request body: {
"state": "SUCCESSFUL",
"key": "Project",
"name": "CI-Build",
"url": "https://devops/Project/Repo/_build/results?buildId=822",
"description": "Build status from Azure Devops Server"
}
Response Code: 0
Response: An error was encountered while processing request. Exception: <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops, can't find that - Bitbucket</title><script>
....
Exception Message: The remote server returned an error: (404) Not Found. (type WebException)
I'm able to run the Postman request from the Azure DevOps machine, so there is no firewall issue.
Interestingly, I noticed that the address the REST call goes out to has a weird // after the machine address, don't know if that's something that could cause the issue...?
Since there is no post-execution gate in Azure DevOps build pipelines (similar to the release gates), I haven't figured out a better way to do this.
Has anyone else been successful in this?
Thanks,
Karri
According to this document, you can try do with a simple script in your pipeline and update with the build id.
script: |
import os
id = os.getenv('BUILD_BUILDID')
print(id)
Here is a case with similar issue you can refer to.
I was able to solve the connection issue in the end.
The reason for this is rather stupid, and was in fact related to the formation of the POST request URL in the task. Removing the first /-character worked and now the request is successfully sent to Bitbucket Server.

API Gateway Mock Integration Fails with 500

I have an API Gateway integration for a method/resource which works when I call it from the API but not when I actually call it:
$ aws apigateway test-invoke-method --rest-api-id $REST_API_ID \
--resource-id $RESOURCE_ID --http-method GET | jq -r .log,.body
This works out fine and I get the following output:
Tue May 16 17:46:42 UTC 2017 : Starting execution for request: test-invoke-request
Tue May 16 17:46:42 UTC 2017 : HTTP Method: GET, Resource Path: /status.json
Tue May 16 17:46:42 UTC 2017 : Method request path: {}
Tue May 16 17:46:42 UTC 2017 : Method request query string: {}
Tue May 16 17:46:42 UTC 2017 : Method request headers: {}
Tue May 16 17:46:42 UTC 2017 : Method request body before transformations:
Tue May 16 17:46:42 UTC 2017 : Endpoint response body before transformations:
Tue May 16 17:46:42 UTC 2017 : Endpoint response headers: {}
Tue May 16 17:46:42 UTC 2017 : Method response body after transformations: { "statusCode": 200 }
Tue May 16 17:46:42 UTC 2017 : Method response headers: {Content-Type=application/json}
Tue May 16 17:46:42 UTC 2017 : Successfully completed execution
Tue May 16 17:46:42 UTC 2017 : Method completed with status: 200
{ "statusCode": 200 }
However, I cannot access this at my URL, which is api.naftuli.wtf/v1/status.json. I have stages defined at glhf, stable, and v1, so by replacing that, you will see different responses. I just simply want a dummy response that returns a 200 JSON blob.
My Terraform for the resources is here as a Gist. Hopefully this fully shows my API Gateway configuration.
If I test invoke this from the CLI or from the web console, I get back what is expected. However, if I curl this from my deployed API at api.naftuli.wtf, I don't get anything nice:
$ for stage in glhf stable v1 ; do
> url="https://api.naftuli.wtf/${stage}/status.json"
> echo "${url}:"
> curl -i -H 'Content-Type: application/json' \
> https://api.naftuli.wtf/${stage}/status.json
> echo -e '\n
> done
https://api.naftuli.wtf/glhf/status.json:
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 36
Connection: keep-alive
Date: Tue, 16 May 2017 21:41:38 GMT
x-amzn-RequestId: 712ba52b-3a80-11e7-9fec-b79b62d3bf7f
X-Cache: Error from cloudfront
Via: 1.1 da7a5d0ed7f424609000879e43743066.cloudfront.net (CloudFront)
X-Amz-Cf-Id: hBwlbPCP9n2rlz53I-Qb9KoffHB_FoxUCZUaJYNnU3XhCWuMpQTP1Q==
{"message": "Internal server error"}
https://api.naftuli.wtf/stable/status.json:
HTTP/1.1 403 Forbidden
Content-Type: application/json
Content-Length: 23
Connection: keep-alive
Date: Tue, 16 May 2017 21:41:38 GMT
x-amzn-RequestId: 71561066-3a80-11e7-9b00-6700be628328
x-amzn-ErrorType: ForbiddenException
X-Cache: Error from cloudfront
Via: 1.1 0c146399837c7d36c1f0f9d2636f8cf8.cloudfront.net (CloudFront)
X-Amz-Cf-Id: ITX765xD8s4sNuOdXaJ2kPvqPo-w_dsQK3Sq_No130FAHxFuoVhO8w==
{"message":"Forbidden"}
https://api.naftuli.wtf/v1/status.json:
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 36
Connection: keep-alive
Date: Tue, 16 May 2017 21:41:39 GMT
x-amzn-RequestId: 7185fa99-3a80-11e7-a3b1-2f9e659fc361
X-Cache: Error from cloudfront
Via: 1.1 586f1a150b4ba39f3a668b8055d4d5ea.cloudfront.net (CloudFront)
X-Amz-Cf-Id: dvnOa1s-YlwLSNzBfVyx5tSL6XrjFJM4_fES7MyTofykB3ReU5R1fg==
{"message": "Internal server error"}
My understanding of stages were that they were additional path prefixes to the base path under which all API resources were available. If I had a stage called v1 with a path of /v1, I'd expect that an API Gateway resource for status.json will be basically mapped under /v1, yielding /v1/status.json.
I may be misunderstanding how API Gateway base path mappings and stages work, but CloudWatch tells me that the call is at least happening, though failing for some obscure reason:
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) Verifying Usage Plan for request: c5be3842-6af4-4725-a34f-d6eea8042d17. API Key: API Stage: tcips69qx2/prod_v1
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) API Key authorized because method 'GET /status.json' does not require API Key. Request will not contribute to throttle or quota limits
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) Usage Plan check succeeded for API Key and API Stage tcips69qx2/prod_v1
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) Starting execution for request: c5be3842-6af4-4725-a34f-d6eea8042d17
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) HTTP Method: GET, Resource Path: /v1/status.json
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) Execution failed due to configuration error: statusCode should be an integer which defined in request template
21:41:39(c5be3842-6af4-4725-a34f-d6eea8042d17) Method completed with status: 500
Apparently only traffic across the V1 stage is getting through to CloudWatch logs. I have a misconfiguration somewhere and I can't seem to find it.
Can you try and change you request template in the integration request setup to this:
{
"statusCode": 200
}
API Gateway looks for the status code to return in the response in your integration request template. The response is generated by the mapping template in the integration response. I can see from your terraform setup that you are loading the output json file in the integration request template. This is content API Gateway does not expect.
With Mock Integration Amazon API Gateway there are 2 common reasons for 500 Internal Server error.
Check the mapping template in Integration Request and ensure that you are passing statusCode as an integer to the MOCK Integration endpoint.
{
"statusCode": <Integer_Status_code>
}
Note: Make sure that status code is passed as integer not string.
Correct : 200 Incorrect : "200"
Mock Integrations do not support the binary content. If the API is enabled with bixnary support and has application/json or */* set as binaryMediaTypes, MOCK Integration endpoints would throw a 500 Internal server error when trying to transform the content.
A workaround is to update the contentHandling property of the MOCK Integration to CONVERT_TO_TEXT
Read more here :- https://cloudnamaste.com/500-internal-server-error-mock-integration/
For my case, when I deploy the lambda with serverless framework, the OPTIONS returns 200 when called. However, when I configure manually on AWS API Gateway, it returns 500 Internal Server Error.
When I check the execution log of API gateway, it said
(ee0a42d9-2cfc-4788-8679-00fbd7938cf1) Method request body before transformations: [Binary Data]
(ee0a42d9-2cfc-4788-8679-00fbd7938cf1) Execution failed due to configuration error: Unable to transform request
(ee0a42d9-2cfc-4788-8679-00fbd7938cf1) Gateway response body:
{
"message": "Internal server error"
}
After you create the Resources and OPTIONS methods, select the OPTIONS method then
At Method Execution --> Integration Request --> expand the Mapping Templates, choose "When no template matches the request Content-Type header". Add or select "application/json" in the Content-Type. Click the "application/json", and in the Generate template, paste
{statusCode: 200} without any double quote. Note, if the {"statusCode": 200} exists but with double quote, remove it to be the same as above. Then Save it
At Method Execution --> Integration Response --> expand the 200 response status --> Mapping Template --> Add or select "application/json" in the Content-Type. Make sure that the Generate template box is empty. Then Save it
At Method Execution --> Method Response --> expand the 200 response. In Response Headers for 200, add three headers: Access-Control-Allow-Headers, Access-Control-Allow-Methods, and Access-Control-Allow-Origin. Leave the Response Body for 200 to be empty
Action --> Enable CORS for the Resource
Action --> Deploy API
You have at least two distinct problems with your configuration.
First, one of your three base path mappings doesn't match the way you're trying to invoke your API. Note that the base paths don't have to be the same as your stage names, but they can be if you desire. Since your base path mappings include base paths and stage names, API Gateway is expecting the invoke path to include a base path mapping and not a stage, so it is interpreting the [glhf stable v1] portion of your path as a base path and looking for the corresponding base path mapping entry to determine the API and stage to use. This works fine for the v1 and glhf base paths which return 500 (indicating a different problem). The stable base path (in https://api.naftuli.wtf/stable/status.json) returns a 403 Forbidden because there is no base path of "stable" defined for the domain name api.naftuli.wtf. The stable stage is mapped to the "latest" base path, so calling https://api.naftuli.wtf/latest/status.json should be the way to call the stable stage. This doesn't currently work, and I don't know why. If you tell me what region your running this in, I can look-up the config and do more digging.
The second problem is indicated by the following entry from your CloudWatch logs:
Execution failed due to configuration error: statusCode should be an integer which defined in request template
Can you check that your integration request template (in the file your reference in "${file("${path.module}/files/status.json")}") contains "statusCode: 200" as a top level attribute.
I also found it surprising that you're using the same file for a request template and a response template.
Having had the identical errors I found what helped me solve this issue was to delete my OPTIONS request definition in the AWS Console. I then followed the console's "Enable CORS" form which created a new OPTIONS method.
I subsequently ran terraform plan and looked at the diff between my OPTIONS defintion and theirs. Given that the AWS Console created OPTIONS method worked I applied the changes.
Using terraform 0.12 or greater makes this possible as the terraform plan output detail is more fine grained.
I was doing this in CloudFormation.
It took me a while to get it and the accepted answer here was extremely helpful, but a little vague, so adding some more info.
Stefano Buliani's answer, in CloudFormation YAML, looks like:
RequestTemplates:
application/json: |
{ statusCode: 200 }
What was especially weird here was apparently, the fix was simply to create a deployment using the AWS CLI for each of the stages. Apparently, Terraform was not updating or re-kicking deployments on changes, and so my changes never got out.
I had a similar problem and eventually figured out that my client was using a different content type than I expected. I had foolishly assumed it would use application/json, but it was some custom json thing. In my setup, API Gateway is logging to cloudwatch, which is where I found the content type it received from the client. Once I updated the content type in the request template of the mock integration, things worked as expected.

webHDFS API returns Exception on every query

I setuped single node Hadoop cluster to perform some experiments with HDFS. Via web access all looks good, I created a dedicated folder and copied file from local system to it using command line. It all appeared in web UI. After it I to get access to it via WebHDFS.
For example:
curl -i "http://127.0.0.1:50075/webhdfs/v1/?op=LISTSTATUS"
But after that I get:
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 154
Connection: close
{
"RemoteException":
{
"exception":"IllegalArgumentException",
"javaClassName":"java.lang.IllegalArgumentException",
"message":"Invalid operation LISTSTATUS"
}
}
The same error I receive on any another command.
I have no idea what went wrong here. Can it be caused for example by missing some components or anything else during setup?
For HDP you can use following URL (with default port):
http://x.x.x.x:50070/webhdfs/v1/?op=LISTSTATUS
For MapR cluster (with default port):
http://x.x.x.x:14000/webhdfs/v1/user?op=LISTSTATUS&user.name=YOUR_USER

Trying to do a SiteTraversal with Yodlee

I am following the quick start guide and I am able to get both the Cobrand and User token's, however when I try to make a POST request to https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/SiteTraversal/searchSite, I receive a 404 doc not found. I am able to use wget to download the file for /authenticate/login as shown below, but wget receives a 404.
zachallett# ~/code/yodlee/sampleapp
$ wget https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/SiteTraversal/searchSite
--2013-12-09 14:48:02-- https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/SiteTraversal/searchSite
Resolving rest.developer.yodlee.com... 216.35.6.163
Connecting to rest.developer.yodlee.com|216.35.6.163|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-12-09 14:48:03 ERROR 404: Not Found.
zachallett# ~/code/yodlee/sampleapp
$ wget https://rest.developer.yodlee.com/services/srest/restserver/v1.0/authenticate/login
--2013-12-09 14:48:16-- https://rest.developer.yodlee.com/services/srest/restserver/v1.0/authenticate/login
Resolving rest.developer.yodlee.com... 216.35.6.163
Connecting to rest.developer.yodlee.com|216.35.6.163|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: ‘login’
[ <=> ] 16 --.-K/s in 0s
2013-12-09 14:48:16 (1.53 MB/s) - ‘login’ saved [16]
I have tried using this from an external REST client and it works.
Here is the request
POST /services/srest/restserver/v1.0/jsonsdk/SiteTraversal/searchSite HTTP/1.1
Host: rest.developer.yodlee.com
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
cobSessionToken=xxxxxxxxxxxxxxxxxxxxxxxx&userSessionToken=xxxxxxxxxxxxxxxxxxxxxxx&siteSearchString=dag