Reputation: 5
I was implementing the following node.js code
I have created COS but there is an error in response
import S3 from "ibm-cos-sdk/clients/s3.js";
var config = {
endpoint: 's3.private.jp-tok.cloud-object-storage.appdomain.cloud',
apiKeyId: 'xxxx',
serviceInstanceId: 'crn:v1:bluemix:public:cloud-object-storage:global:a/dbad72afdcb81fac6df4:3bf9d86f-811f-480b-af51-ab1401c5e643::',
signatureVersion: 'iam',
region:"jp-tok"
};
var cos = new S3(config);
var request = cos.listBuckets();
request.on('complete', function(response) { console.log(response) }); // register a callback
request.send();
export default cos
The response I got after a while was:
request: Request {
domain: null,
service: Service {
config: [Config],
endpoint: [Endpoint],
_events: [Object],
MONITOR_EVENTS_BUBBLE: [Function: EVENTS_BUBBLE],
CALL_EVENTS_BUBBLE: [Function: CALL_EVENTS_BUBBLE],
_clientId: 1
},
operation: 'listBuckets',
params: {},
httpRequest: HttpRequest {
method: 'GET',
path: '/',
headers: [Object],
body: '',
endpoint: [Object],
region: 'jp-tok',
_userAgent: 'ibm-cos-sdk-nodejs/1.13.1 win32/v18.16.0',
stream: [ClientRequest]
},
startTime: 2023-07-27T09:12:24.128Z,
response: [Circular *1],
_asm: AcceptorStateMachine { currentState: 'complete', states: [Object] },
_haltHandlersOnError: false,
_events: {
validate: [Array],
afterBuild: [Array],
restart: [Array],
sign: [Array],
validateResponse: [Array],
send: [Array],
httpHeaders: [Array],
httpData: [Array],
httpDone: [Array],
retry: [Array],
afterRetry: [Array],
build: [Array],
extractData: [Array],
extractError: [Array],
httpError: [Array],
beforePresign: [Array],
complete: [Array]
},
emit: [Function: emit],
signedAt: 2023-07-27T09:13:29.511Z
},
data: null,
error: Error: connect ETIMEDOUT 10.1.129.66:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
errno: -4039,
code: 'TimeoutError',
syscall: 'connect',
address: '10.1.129.66',
port: 443,
time: 2023-07-27T09:13:50.548Z,
region: 'jp-tok',
hostname: 's3.private.jp-tok.cloud-object-storage.appdomain.cloud',
retryable: true
},
retryCount: 3,
redirectCount: 0,
httpResponse: HttpResponse {
statusCode: undefined,
headers: {},
body: undefined,
streaming: false,
stream: null,
_abortCallback: [Function: callNextListener]
},
maxRetries: 3,
maxRedirects: 10
}
**what i am doing wrong(i am using a lite account which i got for IBM hackchallenge india 2023 )
the main aim is to make a API that stores the pdf file sent in base64 form with a key and get the pdf when needed
i have a feel that this error is due to my account type as IBM cloud function also didn't work**
Upvotes: 0
Views: 77