Closed victorshinya closed 3 years ago
Ignore the const decodedFileName = decodeURIComponent(fileName);
line. I tried to decode the URI before the copyObject
call method, but the error is the same as without it.
A few things to check:
CopySource
.@IBMeric yes, the object exists. Before the execution of CopyObject
method, I actually access the object, download it and process so the Serverless function can send the logs to IBM Log Analysis (LogDNA).
And thanks for your answer. I had to enforce the encoding the fileName (including folders and subfolders) and it worked.
Just replaced the decodeURIComponent()
to const encodedURI = encodeURI(fileName);
and it worked.
I am working with Flow Logs for VPC and I've developed a Serverless function to send all logs from COS to IBM Log Analysis (LogDNA), with a similar structure as my another project (logdna-cos). The function downloads the log file, unzip and format to perform a HTTP request to LogDNA through Ingestion API, then copy the object from the source bucket to another bucket within the COS instance.
The Flow Logs for VPC saves the log file in a different way, with several subfolders In a bucket. When I execute the function, it always returns a
NoSuchKey: The specified key does not exist
error when it performs the (COS)copyObject
method. I attached the log I am receiving with the name of the file and the method I am using to call thecopyObject
method.Node.js function
The error log