I am getting an error when uploading a file to the Google Cloud Storage system. I am using the upload from memory operation and using a non-resumable upload. It is a 500 error with no message that is hard to discern what the issue is.
GCP Storage API Documentation being used here: https://googleapis.dev/nodejs/storage/7.10.0/File.html#save
Here is the code I am using
const { Storage } = require('@google-cloud/storage');
import { googleStorageClientOptions } from './configuration/credentials';
import { Logger } from './loggerAbstraction';
const googleCloudStorageClient = new Storage(googleStorageClientOptions);
async function storageServiceUpload(fileData: any, log: Logger) {
try {
const contents = "this is a string";
let file;
try {
file = await googleCloudStorageClient.bucket('bucket_example').file("testfile.txt").save(contents, { resumable: false })
} catch (err) {
console.log('error in file upload', err);
return null;
}
console.log("file", {file})
return file;
} catch (err) {
console.log('error in file upload', err);
return null;
}
}
Here is the error I am receiving back from GCP:
ApiError: Internal Server Error
at new ApiError (/node_modules/@google-cloud/storage/build/cjs/src/nodejs-common/util.js:114:15)
at Util.parseHttpRespMessage (/node_modules/@google-cloud/storage/build/cjs/src/nodejs-common/util.js:220:41)
at Util.handleResp (/node_modules/@google-cloud/storage/build/cjs/src/nodejs-common/util.js:192:30)
at /node_modules/@google-cloud/storage/build/cjs/src/nodejs-common/util.js:583:22
at onResponse (/node_modules/retry-request/index.js:259:7)
at /node_modules/teeny-request/build/src/index.js:157:17
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
I am unable to find helpful content around what the issue might be, any help would be appreciated!