skip to Main Content

I am executing the following code but getting error

//preparing upload parameters
    const params = {
      Bucket: `${config.s3bucket}`,
      Key: `${objectDirectory}/${objectKey}`,
    };

    //geenerating signed url, valid only for 15 minutes
    const command = new PutObjectCommand(params);
    const signedUrl = await getSignedUrl(s3Client, command, {
      expiresIn: 900,
    });

Code 2

const bucketParams = {
      Bucket: config.s3bucket,
      Key: `Profiles/${result.profilePicture}`,
    };
    const command = new GetObjectCommand(bucketParams);
    const urls = await getSignedUrl(s3Client, command, {
      expiresIn: 60 * 60 * 168,
    });

Error Message:

{
    "message": "TypeError: Cannot read properties of undefined (reading 'sso_session')"
}

the error occurs whenever I am executing getSignedUrl

2

Answers


  1. Same is happening to me, rolling back @aws-sdk/s3-request-presigner to 3.208.0 as said in https://github.com/aws/aws-sdk-js-v3/issues/4183 didn’t work

    Login or Signup to reply.
  2. I am assuming that you are using 2 stacks and trying to call properties from stack1 in stack2:

    Try making it a "publicly readonly" in the 1st stack and in the 2nd stack create an interface to hold the signedURL information.

    export interface <custom_name1> extends cdk.StackProps {
      signed_url: s3.getSignedUrl
    }
    
    constructor(scope: Construct, id: string, props: <custom_name1>) {
      get_signed_url = props.signed_url
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search