Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (Throwing Error('Duration.toString()) from CloudfrontToS3/Kinesisstreams-Kinesisfirehose-s3) #223

Closed
biffgaut opened this issue Jun 15, 2021 · 0 comments · Fixed by #224
Assignees
Labels
bug Something isn't working in-progress This issue is being actively worked on

Comments

@biffgaut
Copy link
Contributor

This code:

export class ClientStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);
    new KinesisStreamsToKinesisFirehoseToS3(this, 'stream', {});
    const logBucket = new s3.Bucket(this, 'separate-bucket', {});
    /**
     * Throws Error('Duration.toString() was used, but .toSeconds, .toMinutes 
     * or .toDays should have been called instead');
     */
    new CloudFrontToS3(this, 'CloudFrontToS3', {
      // bucketProps: {
      //   serverAccessLogsBucket: logBucket,
      //   serverAccessLogsPrefix: 'ui-s3/'
      // },
      cloudFrontDistributionProps: {
        // enableLogging: true,
        errorResponses: [
          { httpStatus: 403, responseHttpStatus: 200, responsePagePath: '/index.html' },
          { httpStatus: 404, responseHttpStatus: 200, responsePagePath: '/index.html' }
        ],
        logBucket: logBucket,
        logFilePrefix: 'ui-cf/'
      },
      insertHttpSecurityHeaders: false
    });
  }
}

Throws this error:

  public toJSON(): any {
            ^
Error: Argument to Intrinsic must be a plain value object, got () => {
            throw new Error('Duration.toString() was used, but .toSeconds, .toMinutes or .toDays should have been called instead');
        }
    at new Intrinsic (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-cdk/core/lib/private/intrinsic.ts:37:13)
    at Function.asAny (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-cdk/core/lib/token.ts:102:48)
    at Function.asString (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-cdk/core/lib/token.ts:79:53)
    at Duration.toString (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-cdk/core/lib/duration.ts:219:18)
    at realTypeOf (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-solutions-constructs/core/node_modules/deep-diff/index.js:117:81)
    at deepDiff (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-solutions-constructs/core/node_modules/deep-diff/index.js:193:9)
    at deepDiff (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-solutions-constructs/core/node_modules/deep-diff/index.js:255:15)
    at deepDiff (/Users/biffgaut/Documents/Active/AWS/Constructs/beomseok/client/node_modules/@aws-solutions-constructs/core/node_modules/deep-diff/index.js:255:15)

Reproduction Steps

Error Log

Environment

  • CDK CLI Version : 1.06.1
  • CDK Framework Version: 1.106.1
  • AWS Solutions Constructs Version : 1.106.1
  • OS : iOS
  • Language : Typescript

Other


This is 🐛 Bug Report

@biffgaut biffgaut added bug Something isn't working needs-triage The issue or PR still needs to be triaged in-progress This issue is being actively worked on and removed needs-triage The issue or PR still needs to be triaged labels Jun 15, 2021
@biffgaut biffgaut self-assigned this Jun 15, 2021
@biffgaut biffgaut linked a pull request Jun 15, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in-progress This issue is being actively worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant