Skip to content

secure-media-delivery-at-the-edge-on-aws CDK Deployment failed with "RangeError: Maximum call stack size exceeded"

0

I was trying to re-work the solution "secure-media-delivery-at-the-edge-on-aws" to bypass the use of DynamoDB and directly use the videos from S3. Unfortunately the build and deploy steps provided here always results in an exception "RangeError: Maximum call stack size exceeded".

The solution deployment is failing even with the main branch of the repository without making any changes.

$ npx cdk bootstrap
D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:942
  return s.replace(/\\(.)/g, '$1')
           ^
RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at globUnescape (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:942:12)
    at Minimatch.parse (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:643:12)
    at Array.map (<anonymous>)
    at Minimatch.<anonymous> (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:197:14)
    at Array.map (<anonymous>)
    at Minimatch.make (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:196:13)
    at new Minimatch (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:154:8)
    at minimatch (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\node_modules\minimatch\minimatch.js:125:10)
    at GlobIgnoreStrategy.ignores (D:\...\secure-media-delivery-at-the-edge-on-aws\source\node_modules\aws-cdk-lib\core\lib\fs\ignore.js:1:2408)
****************************************************
*** Newer version of CDK is available [2.162.0]  ***
*** Upgrade recommended (npm install -g aws-cdk) ***
****************************************************

Subprocess exited with error 1

Can anyone help me with the deployment of the solution? Also, is there a simple way to use the solution without using DynamoDB? I would like to generate tokens directly from S3 without using an additional DB to store the urls for each video in the S3.

1 Answer
0

I apologize for the difficulty you're experiencing with the deployment of the Secure Media Delivery at the Edge on AWS solution. The error you're encountering suggests an issue with the CDK deployment process, specifically related to the maximum call stack size being exceeded.

To address this issue, you could try the following steps:

  1. Ensure you're using the latest version of Node.js and CDK. The error message indicates that a newer version of CDK (2.162.0) is available. Try upgrading CDK by running npm install -g aws-cdk as suggested in the error message.

  2. Clear your node_modules directory and reinstall dependencies. Sometimes, conflicting or corrupted dependencies can cause issues. Try deleting the node_modules folder and running npm install again.

  3. If the issue persists, you might want to try increasing the Node.js stack size. You can do this by setting the --stack-size flag when running the CDK command, like this: node --stack-size=8192 npx cdk bootstrap.

Regarding your question about using the solution without DynamoDB and generating tokens directly from S3, it's important to note that the solution is designed to work with DynamoDB for storing and managing access tokens. Modifying the solution to work directly with S3 without using DynamoDB would require significant changes to the architecture and code of the solution.

The solution uses DynamoDB not just for storing video URLs, but also for managing access tokens, session information, and other metadata crucial for the content protection mechanism. Removing DynamoDB would require re-engineering the token generation and validation processes, which are core components of the solution.

If you're looking for a simpler approach, you might consider implementing a custom solution using CloudFront signed URLs or signed cookies, which can provide access control for your S3-hosted videos without the need for a separate database. However, this would not provide all the features of the Secure Media Delivery at the Edge solution, such as geo-restrictions and advanced session management.

For your specific use case, it might be beneficial to consult with AWS Support or consider engaging with AWS Professional Services to explore customization options that meet your requirements while maintaining the security and scalability benefits of the original solution.
Sources
CDK deployment - Secure Media Delivery at the Edge on AWS
Security - Secure Media Delivery at the Edge on AWS
Deploy this solution to protect your premium video content from unauthorized access when delivered through Amazon CloudFront - Secure Media Delivery at the Edge on AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.