Request failed with status code 401 com.google.step_count.delta - google-fit

{"message":"Request failed with status code 401","name":"Error","stack":"Error: Request failed with status code 401\n at createError (/home/user/Projects/HealthBlock/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/home/user/Projects/HealthBlock/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/home/user/Projects/HealthBlock/node_modules/axios/lib/adapters/http.js:260:11)\n at IncomingMessage.emit (events.js:203:15)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)","config":{"url":"https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate","method":"post","data":"{"aggregateBy":[{"dataTypeName":"com.google.step_count.delta","dataSourceId":"derived:com.google.step_count.delta:com.google.android.gms:estimated_steps"}],"bucketByTime":{"durationMillis":86400000},"startTimeMillis":1585785599000,"endTimeMillis":1585958399000}","headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json;charset=utf-8","authorization":"Bearerya29.a0ARrdaM8Rx7JTevizLGoMkJYBqAGba27LtAQKbnodcgXsqkUFVyBFgm4ZNAvci84LbiowSnmpNxFhGCKcq1UKk6819L37kd1HPPbeXNsrmrbPjZu6pM7Jsw9p7xIwsMJLYZFrg4lNkgoPbMOFA5ZIlY021C0C","User-Agent":"axios/0.21.1","Content-Length":261},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"Content-Type":"application/json"}}

401 error response status code indicates that the client request has not been completed. Double check your credentials (i.e. client ID and client secret) are correct and there are no blank spaces.

Related

C# revit addin Error: Upload failed. Reason = Response status code does not indicate success: 504 (GATEWAY_TIMEOUT)

We are using c# revit addin in our project.
Design automation requests are getting failed with the error "status": "failedUpload",
Here is the report file for more details
[09/08/2022 17:30:21] Finished running. Process will return: Success
[09/08/2022 17:30:21] ====== Revit finished running: revitcoreconsole ======
[09/08/2022 17:30:25] End Revit Core Engine standard output dump.
[09/08/2022 17:30:25] End script phase.
[09/08/2022 17:30:25] Start upload phase.
[09/08/2022 17:30:25] Uploading 'T:\Aces\Jobs\ad78879202894efba8c5145367e8275d\result.rvt': verb - 'PUT', url - 'https://developer.api.autodesk.com/oss/v2/buckets/generatedmodels/objects/20220908164214_1305 - Interior purged.rvt'
[09/08/2022 17:31:27] Error: Retrying on GatewayTimeout. Request is 'PUT' 'https://developer.api.autodesk.com/oss/v2/buckets/generatedmodels/objects/20220908164214_1305 - Interior purged.rvt'
[09/08/2022 17:32:34] Error: Retrying on GatewayTimeout. Request is 'PUT' 'https://developer.api.autodesk.com/oss/v2/buckets/generatedmodels/objects/20220908164214_1305 - Interior purged.rvt'
[09/08/2022 17:33:51] Error: Retrying on GatewayTimeout. Request is 'PUT' 'https://developer.api.autodesk.com/oss/v2/buckets/generatedmodels/objects/20220908164214_1305 - Interior purged.rvt'
[09/08/2022 17:35:23] Error: Retrying on GatewayTimeout. Request is 'PUT' 'https://developer.api.autodesk.com/oss/v2/buckets/generatedmodels/objects/20220908164214_1305 - Interior purged.rvt'
[09/08/2022 17:35:23] Error: Failed - 504 (GATEWAY_TIMEOUT)
Request: PUT https://developer.api.autodesk.com/oss/v2/buckets/generatedmodels/objects/20220908164214_1305 - Interior purged.rvt
Request Headers:
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlU3c0dGRldUTzlBekNhSzBqZURRM2dQZXBURVdWN2VhIn0.eyJzY29wZSI6WyJidWNrZXQ6Y3JlYXRlIiwiYnVja2V0OnJlYWQiLCJidWNrZXQ6ZGVsZXRlIiwiZGF0YTpyZWFkIiwiZGF0YTp3cml0ZSIsImRhdGE6Y3JlYXRlIiwiY29kZTphbGwiXSwiY2xpZW50X2lkIjoidFBvVGQ0dENuTEhrajlZMEtRYWRyVFdBT0pLSUxzN1AiLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvYWp3dGV4cDYwIiwianRpIjoiU0pnc1N2TjdKTjhFSkhNeFRpdUhmMko2Y3ZTTXhZVW9UZXphcmRJcFNocHZjOWFDM1pzdVVPeDhESjNRc0toViIsImV4cCI6MTY2MjY1ODc0OH0.PJPp7LroxjWkFD7i3_ErLGyM_wS_D0ir1Qr-w9TfHazaEpmZSrwQ6QsRKcJ9ibXS5z9RY_5WGtzojDPyNTF4kP9TISpgJlyJivbLTnxv7oqW_acd0FvQYlvsaozrx_HIfRJIJLLuF_k1gGwpeArK9yQrKtWYSY1_5c3t1QQSEAs4i5HVyWlPPT8eEsQDtY_EYj32QQoeIMnfI3XWWQBkhD1LnbI9yIzLJ0D8ZWzXbbzD78wAhYudzLsW_0ay3YQRd6fTerUVLHaQ0UgyjvFfTVOV5mFZimERqtpyKynIEnF4JBKZGzhzxv-OlEVNe31o5CLr4oy1QBj_E53q5ZX4Ug
Request Content Headers:
Content-Length: 818163712
Response Headers:
Connection: keep-alive
Response Content Headers:
Content-Length: 0
Response Body:
[09/08/2022 17:35:23] Error: Upload failed. Reason = Response status code does not indicate success: 504 (GATEWAY_TIMEOUT).
[09/08/2022 17:35:23] Error: An unexpected error happened during phase Publishing of job.
[09/08/2022 17:35:24] Job finished with result FailedUpload
[09/08/2022 17:35:24] Job Status:
{
"status": "failedUpload",
"reportUrl": "https://dasprod-store.s3.amazonaws.com/workItem/tPoTd4tCnLHkj9Y0KQadrTWAOJKILs7P/ad78879202894efba8c5145367e8275d/report.txt?X-Amz-Expires=48600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQCgs4MB0vOFtfkJkyouuTSkaG5tzGqnIwaHN41D2ec5IgIgO8%2BddPJXEyQV0NP3R6iKxG7LGccF%2FJtCOZfmDc6oANsqgAMIMBADGgwyMjA0NzMxNTIzMTAiDMhdkXkWdvEoT%2BJc%2FSrdAk0REkrcSRlPtnlJTvPShrpoDhptZ%2FsoZAkNW%2BSWnSY%2FZom%2BNsa2qpmWopbOljmbOcBcmhh2K4JG9dN1AbErLjwd73f3cEId3gQoaE7O1CuBNhzl27K7MQ4tCva%2FxdkYNFV6r0Z%2FdJSylvSYrFyrrTS1jK5da2bL6tXBaJ1GByvRiOlGlDrXFyvNSnp%2FTJT1tJhX6wUGgpUaydqSHGfBsqXR%2Bwzskf8iKLZ7Z75oqCkZwmC9azQARwRT0PoSLTcR4RotaqDDdV8xYqCDUE0Us1ihVMYHKW%2FIrgMiDt5Vb3Cx5YJ68SNbNUAPG5JTmTyG%2BlWQiVXaV3IrH4SWktb494A5CJNJo6CkRmusDEPrvnEfiebWxAUwepcJl%2FU%2FJ8jj7Et1oROuReOS9obYtNHlodcEIOuaG62bsgw53awHzz095z9FV9ZNbStdmqb032uJmiSBWfaPr%2F8Zz7oSiykwpZDomAY6ngF5QHnzayjkxc04F41tGu31CD6DyAhmHq6XVZIUa3hwer76cIjHaZFSM1hWlrCwUUfGesfXXVI81KJrqaqyXkUkUshGBD2tEtvvyYb1CnYvnVssn28Rc0LNNl8WgFwPlfrPutbxT5yRsYTD1aAD2B80wHwBJ7vNLNUnonRMWUzY8QW%2BTO9F8pzb%2FGjLqQTlj3Ne4SM4Fpz8EXIng4gmNA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIATGVJZKM3BTQV7AHO/20220908/us-east-1/s3/aws4_request&X-Amz-Date=20220908T164217Z&X-Amz-SignedHeaders=host&X-Amz-Signature=f60e89e4fbd1527ba46c42480e64268483c15c5efdcb80ed2623144fbd222317",
"stats": {
"timeQueued": "2022-09-08T16:42:17.9517893Z",
"timeDownloadStarted": "2022-09-08T16:42:18.2481411Z",
"timeInstructionsStarted": "2022-09-08T16:43:20.1483203Z",
"timeInstructionsEnded": "2022-09-08T17:30:25.5436836Z",
"timeUploadEnded": "2022-09-08T17:35:23.6506512Z",
"bytesDownloaded": 1574150920
},
"id": "ad78879202894efba8c5145367e8275d"
}
Please help me to figure out the solution for this problem?
You need to finalize the upload, i.e, after design automation puts file to your s3 bucket you need to call buckets/:bucketKey/objects/:objectKey/signeds3upload
This can be done in OnCallback event, refer https://github.com/Autodesk-Forge/learn.forge.designautomation/blob/7d57b39014de5fccb0f082a9dd50a039bdcb2569/forgesample/Controllers/DesignAutomationController.cs#L456
Refer - https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step6-prepare-cloud-storage/#step-4-complete-the-upload

Json data not get in terminal & get error->(SyntaxError: Unexpected end of JSON input)

I am trying to get some value from Youtube Api. Now, My express code is->
https.get("https://www.googleapis.com/youtube/v3/videos?part=snippet&id=qW_SWM1wpMA&key=MYAPIKEY",function(res){
res.on("data",function(data){
const da=JSON.parse(data);
console.log(da);
})
});
Now, I am console log the data what's coming from api. But I get this error->
$ node app.js
Port is running
undefined:13
"description": "\"Bang Bhaja\" shows how Nonte and Fonte makes a trick to punish Keltu for punishing them from Superintendent Sir for eating the Ilish Maach.\n\nNonte Fonte is a Bengali comic-strip creation of Narayan Debnath which originally was serialized for the childre
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (C:\Users\LENOVO\Desktop\youtube\app.js:13:19)
at IncomingMessage.emit (events.js:314:20)
at IncomingMessage.Readable.read (_stream_readable.js:514:10)
at flow (_stream_readable.js:987:34)
at resume_ (_stream_readable.js:968:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
But when paste the API link (what's mention in above in https.get method) in chrome I get the json data successfully. Then why not i getting the json data in terminal?

Getting error during "truffle migrate" for an ethereum contract on testrpc

While trying out the ethereum contract mentioned at the tutorial: https://medium.com/#ConsenSys/a-101-noob-intro-to-programming-smart-contracts-on-ethereum-695d15c1dab4#.ilmaiavg0 (source code for the tutorial: https://github.com/eshon/conference), I get the following error while doing truffle migrate:
test#test-ubuntu:~/Blockchain/Ethereum/conference$ truffle migrate
Running migration: 1_initial_migration.js
Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Server error
at Object.module.exports.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/errors.js:35:16)
at /usr/local/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:86:36
at [object Object].request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
at [object Object].dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
at setState (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:441:9)
at process._tickDomainCallback (node.js:396:17)
testrpc is up and running, and I see following two lines in testrpc terminal when I run truffle migrate:
127.0.0.1 - - [2016-10-21 09:38:17] "POST / HTTP/1.1" 200 718 0.001741
127.0.0.1 - - [2016-10-21 09:38:17] "POST / HTTP/1.1" 200 493 0.042596
Am I missing anything in the configuration?
My Source Code is at https://github.com/manindra23/conference-contract/tree/develop
Can you just try to give network setup in truffle.js file
like this,
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*' // Match any network id
}
}

REST API Testing: HTTP Post returns 500 with Frisby.js

I am using Frisby.js to submit a POST request with JSON data and test the JSON response. However, my query returns HTTP Status 500. The same POST request works fine in CURL in my command line, as well as Postman. What could be the problem?
CURL request: curl -H "Content-Type: application/json; charset=UTF-8" -X POST -d "json_data" url
FRISBY test:
frisby
.create("Submit request")
.post(url, json_data, {"json": true, "content-type": "application/json;charset=UTF-8"})
.expectStatus(200)
.inspectBody()
.toss();
OUTPUT with Frisby:
Destination URL may be down or URL is invalid, Error: ETIMEDOUT
F
Failures:
1) Frisby Test: Submit request
[ POST url]
Message:
Expected 500 to equal 200.
Stacktrace:
Error: Expected 500 to equal 200.
at null.<anonymous>
at null.<anonymous>
at Timer.listOnTimeout (timers.js:92:15)
Finished in 5.032 seconds
1 test, 1 assertion, 1 failure, 0 skipped
The 500 error and accompanying message that results "Destination URL..." is from Frisby itself, not your server. Frisby adds the error if the connection times out. Try increasing it to 10 seconds.
...
.get(url)
.timeout(10000)
...

Why does the client not accept my WebSocket response handshake?

I use Chrome 14. This is my python websocket server code snippet:
global guid
key = hashlib.sha1(headers['Sec-WebSocket-Key']+guid).digest()
key.encode('iso-')
headers['Sec-WebSotycket-Accept'] = base64.b64encode(key)
print headers['Sec-WebSocket-Accept']
handshake = '\
HTTP/1.1 101 Switching Protocols\r\n\
Upgrade: %s\r\
Connection: %s\r\
Sec-WebSocket-Accept: %s\r\
Sec-WebSocket-Protocol: base64\r\
' %(headers['Upgrade'],headers['Connection'],headers['Sec-WebSocket-Accept'])
try:
self.conn.send(handshake)
except Exception as e:
print e
Why does the Chrome client not accept this server send handshake?
Request URL:ws://127.0.0.1:1234/
Request Headers
Connection:Upgrade
Host:127.0.0.1:1234
Sec-WebSocket-Key:xuV2xuiXxqL4Hwcxjg9dJA==
Sec-WebSocket-Origin:null
Sec-WebSocket-Version:8
Upgrade:websocket
(Key3):00:00:00:00:00:00:00:00
Could it be line 4 of your server code? Your key "Sec-WebSotycket-Accept" looks misspelled.