A
afzal44208 November, 2024

Getting nocode check error in response to s3 object upload

When I tried to use s3 client to upload objects, I am getting errors. Below is the code snippet

const s3 = new S3({
        region: "blr1",
        endpoint: "https://blr1.vultrobjects.com",
        credentials: {
          accessKeyId: process.env.NEXT_PUBLIC_S3_ACCESS_KEY_ID!,
          secretAccessKey: process.env.NEXT_PUBLIC_S3_SECRET_ACCESS_KEY!,
        },
      });
      console.log("File key being loaded:", file_key);

      const s3Url = getS3Url(file_key);


on the other hand

export function getS3Url(file_key: string) {
  const url = `https://${process.env.NEXT_PUBLIC_S3_BUCKET_NAME}.blr1.vultrobjects.com/${file_key}`;
  return url;
}


Comments

A
afzal44210:35 - 09 November, 2024
error:

'$fault': 'client',

  '$metadata': {

    httpStatusCode: 404,

    requestId: 'tx00000123108c759aaf47a-00672f3783-d974cef-blr1',

    extendedRequestId: undefined,

    cfId: undefined,

    attempts: 1,

    totalRetryDelay: 0

  },

  Code: 'NoSuchKey',

  BucketName: 'docbuck',

  RequestId: 'tx00000123108c759aaf47a-00672f3783-d974cef-blr1',

  HostId: 'd974cef-blr1-in'

}
Showing 1 of 1 comments