I run into this issue when running device_test.js in the example folder:
(Console log:)
{"method":"GET","host":"openapi.tuyaus.com","path":"/v1.0/token?grant_type=1","headers":{"client_id":"MYCLIENTID","t":1693774090080,"sign_method":"HMAC-SHA256","sign":"SIGNCODE"},"timeout":30000}
{"method":"GET","host":"openapi.tuyaus.com","path":"/v1.0/token?grant_type=1","headers":{"client_id":"MYCLIENTID","t":1693774091336,"sign_method":"HMAC-SHA256","sign":"SIGNCODE"},"timeout":30000}
{"method":"GET","host":"openapi.tuyaus.com","path":"/v1.0/token?grant_type=1","headers":{"client_id":"MYCLIENTID","t":1693774092356,"sign_method":"HMAC-SHA256","sign":"SIGNCODE"},"timeout":30000}
C:\Users\mysuername\Desktop\a\tuya-cloud-sdk-nodejs\tuyacloud\common\request_handler.js:112
const tcError = new TuyaCloudSDKException(data.code, ErrorCode.getError(data.code));
^
TuyaCloudSDKException [Error]: sign invalid
at HttpConnection.doRequest.timeout (C:\Users\username\Desktop\a\tuya-cloud-sdk-nodejs\tuyacloud\common\request_handler.js:112:41)
at IncomingMessage. (C:\Users\username\Desktop\a\tuya-cloud-sdk-nodejs\tuyacloud\common\http_connection.js:20:17)
at IncomingMessage.emit (node:events:514:28)
at Readable.read (node:internal/streams/readable:539:10)
at flow (node:internal/streams/readable:1023:34)
at resume_ (node:internal/streams/readable:1004:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 1004
}
Notes:
- I have replaced the accessId and accessKey to my correct credentials, also my region is the same one as the specified at my tuya cloud profile (Region.URL_US)
- Using the same credentials in postman gives no error.
- When I search the error code in the tuya docs, I get this:
Please check if you have updated to the new signature algorithm. For more information, see Sign Requests.
but as far as I can tell the algorithm is the same one as the specified in the docs
I run into this issue when running device_test.js in the example folder:
(Console log:)
{"method":"GET","host":"openapi.tuyaus.com","path":"/v1.0/token?grant_type=1","headers":{"client_id":"MYCLIENTID","t":1693774090080,"sign_method":"HMAC-SHA256","sign":"SIGNCODE"},"timeout":30000}
{"method":"GET","host":"openapi.tuyaus.com","path":"/v1.0/token?grant_type=1","headers":{"client_id":"MYCLIENTID","t":1693774091336,"sign_method":"HMAC-SHA256","sign":"SIGNCODE"},"timeout":30000}
{"method":"GET","host":"openapi.tuyaus.com","path":"/v1.0/token?grant_type=1","headers":{"client_id":"MYCLIENTID","t":1693774092356,"sign_method":"HMAC-SHA256","sign":"SIGNCODE"},"timeout":30000}
C:\Users\mysuername\Desktop\a\tuya-cloud-sdk-nodejs\tuyacloud\common\request_handler.js:112
const tcError = new TuyaCloudSDKException(data.code, ErrorCode.getError(data.code));
^
TuyaCloudSDKException [Error]: sign invalid
at HttpConnection.doRequest.timeout (C:\Users\username\Desktop\a\tuya-cloud-sdk-nodejs\tuyacloud\common\request_handler.js:112:41)
at IncomingMessage. (C:\Users\username\Desktop\a\tuya-cloud-sdk-nodejs\tuyacloud\common\http_connection.js:20:17)
at IncomingMessage.emit (node:events:514:28)
at Readable.read (node:internal/streams/readable:539:10)
at flow (node:internal/streams/readable:1023:34)
at resume_ (node:internal/streams/readable:1004:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 1004
}
Notes:
Please check if you have updated to the new signature algorithm. For more information, see Sign Requests.
but as far as I can tell the algorithm is the same one as the specified in the docs