Skip to content

πŸŽ₯ Make videos programmatically with React

remove example lambda

Alex Fernandez91393e76be38
diff --git a/packages/example-lambda/.eslintrc.json b/packages/example-lambda/.eslintrc.json
deleted file mode 100644
index 88654aad42..0000000000
--- a/packages/example-lambda/.eslintrc.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "env": {
- "browser": true,
- "es2021": true
- },
- "overrides": [
- ],
- "parser": "@typescript-eslint/parser",
- "parserOptions": {
- "ecmaVersion": "latest",
- "sourceType": "module"
- },
- "plugins": [
- "@typescript-eslint"
- ],
- "rules": {
- }
-}
diff --git a/packages/example-lambda/.gitignore b/packages/example-lambda/.gitignore
deleted file mode 100644
index 7a593dcb10..0000000000
--- a/packages/example-lambda/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.js
-!jest.config.js
-*.d.ts
-node_modules
-
-# CDK asset staging directory
-.cdk.staging
-cdk.out
-cdk-outputs.json
-dist
\ No newline at end of file
diff --git a/packages/example-lambda/.npmignore b/packages/example-lambda/.npmignore
deleted file mode 100644
index c1d6d45dcf..0000000000
--- a/packages/example-lambda/.npmignore
+++ /dev/null
@@ -1,6 +0,0 @@
-*.ts
-!*.d.ts
-
-# CDK asset staging directory
-.cdk.staging
-cdk.out
diff --git a/packages/example-lambda/README.md b/packages/example-lambda/README.md
deleted file mode 100644
index 36dd8451a8..0000000000
--- a/packages/example-lambda/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-
-## How to Use
-
-1. Clone the repository
-
-2. Install the dependencies
-
-```bash
-pnpm install
-```
-
-3. Create the CDK stack
-
-```bash
-pnpx aws-cdk deploy \
- --outputs-file ./cdk-outputs.json
-```
-
-4. Open the AWS Console and find the lambda
-
-5. Cleanup
-
-```bash
-pnpx exec aws-cdk destroy
-```
diff --git a/packages/example-lambda/bin/remotion-cdk-starter.ts b/packages/example-lambda/bin/remotion-cdk-starter.ts
deleted file mode 100644
index f1e08c9f5c..0000000000
--- a/packages/example-lambda/bin/remotion-cdk-starter.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env node
-import * as cdk from "aws-cdk-lib";
-import { RemotionLambdaStarterStack } from "../lib/remotion-cdk-starter-stack";
-
-const app = new cdk.App();
-new RemotionLambdaStarterStack(app, "remotion-cdk-stack", {
- stackName: "remotion-cdk-stack",
- env: {
- region: process.env.CDK_DEFAULT_REGION,
- account: process.env.CDK_DEFAULT_ACCOUNT,
- },
-});
diff --git a/packages/example-lambda/cdk.json b/packages/example-lambda/cdk.json
deleted file mode 100644
index 6146288ca9..0000000000
--- a/packages/example-lambda/cdk.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "app": "npx ts-node --prefer-ts-exts bin/remotion-cdk-starter.ts",
- "context": {}
-}
diff --git a/packages/example-lambda/lib/remotion-cdk-starter-stack.ts b/packages/example-lambda/lib/remotion-cdk-starter-stack.ts
deleted file mode 100644
index d476db0e40..0000000000
--- a/packages/example-lambda/lib/remotion-cdk-starter-stack.ts
+++ /dev/null
@@ -1,109 +0,0 @@
-import * as apiGateway from "@aws-cdk/aws-apigatewayv2-alpha";
-import * as apiGatewayAuthorizers from "@aws-cdk/aws-apigatewayv2-authorizers-alpha";
-import * as apiGatewayIntegrations from "@aws-cdk/aws-apigatewayv2-integrations-alpha";
-import * as cognito from "aws-cdk-lib/aws-cognito";
-import * as lambda from "aws-cdk-lib/aws-lambda";
-import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
-import * as cdk from "aws-cdk-lib";
-import * as path from "path";
-import { ManagedPolicy, Role, ServicePrincipal } from "aws-cdk-lib/aws-iam";
-
-export class RemotionLambdaStarterStack extends cdk.Stack {
- constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // πŸ‘‡ create the user pool
- const userPool = new cognito.UserPool(this, "userpool", {
- userPoolName: `remotion-starter-user-pool`,
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- selfSignUpEnabled: true,
- signInAliases: { email: true },
- autoVerify: { email: true },
- passwordPolicy: {
- minLength: 6,
- requireLowercase: false,
- requireDigits: false,
- requireUppercase: false,
- requireSymbols: false,
- },
- accountRecovery: cognito.AccountRecovery.EMAIL_ONLY,
- });
-
- // πŸ‘‡ create the user pool client
- const userPoolClient = new cognito.UserPoolClient(
- this,
- "remotion-starter-userpool-client",
- {
- userPool,
- authFlows: {
- adminUserPassword: true,
- userPassword: true,
- custom: true,
- userSrp: true,
- },
- supportedIdentityProviders: [
- cognito.UserPoolClientIdentityProvider.COGNITO,
- ],
- }
- );
-
- // πŸ‘‡ create a role with custom name
- const remotionLambdaServerlessRole = new Role(
- this,
- "remotionLambdaServerlessRole",
- {
- roleName: "remotionLambdaServerlessRole",
- assumedBy: new ServicePrincipal("lambda.amazonaws.com"),
- managedPolicies: [
- ManagedPolicy.fromAwsManagedPolicyName(
- "service-role/AWSLambdaBasicExecutionRole"
- ),
- ],
- }
- );
-
- // πŸ‘‡ create the render function
- const remotionRenderFunction = new NodejsFunction(this, "render-function", {
- runtime: lambda.Runtime.NODEJS_16_X,
- handler: "main",
- entry: path.join(__dirname, `/../src/render-function/index.ts`),
- role: remotionLambdaServerlessRole,
- });
-
- // πŸ‘‡ create the API
- const httpApi = new apiGateway.HttpApi(this, "api", {
- apiName: `remotion-api`,
- });
-
- // πŸ‘‡ create the Authorizer
- const authorizer = new apiGatewayAuthorizers.HttpUserPoolAuthorizer(
- "remotion-user-pool-authorizer",
- userPool,
- {
- userPoolClients: [userPoolClient],
- identitySource: ["$request.header.Authorization"],
- }
- );
-
- // πŸ‘‡ set the Authorizer on the Route
- httpApi.addRoutes({
- integration: new apiGatewayIntegrations.HttpLambdaIntegration(
- "remotion-fn-integration",
- remotionRenderFunction
- ),
- path: "/render",
- authorizer,
- });
-
- // πŸ‘‡ Output
- new cdk.CfnOutput(this, "region", { value: cdk.Stack.of(this).region });
- new cdk.CfnOutput(this, "userPoolId", { value: userPool.userPoolId });
- new cdk.CfnOutput(this, "userPoolClientId", {
- value: userPoolClient.userPoolClientId,
- });
- new cdk.CfnOutput(this, "apiUrl", {
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- value: httpApi.url!,
- });
- }
-}
diff --git a/packages/example-lambda/package.json b/packages/example-lambda/package.json
deleted file mode 100644
index bdcdc5ba4c..0000000000
--- a/packages/example-lambda/package.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "example-lambda",
- "version": "0.0.1",
- "bin": {
- "cdk-starter": "bin/remotion-cdk-starter.js"
- },
- "scripts": {
- "build": "tsc",
- "watch": "tsc -w",
- "cdk": "cdk",
- "type-check": "tsc --project tsconfig.json --pretty --noEmit",
- "lint": "eslint . --ext js,jsx,ts,tsx --fix"
- },
- "dependencies": {
- "@aws-cdk/aws-apigatewayv2-alpha": "^2.50.0-alpha.0",
- "@aws-cdk/aws-apigatewayv2-authorizers-alpha": "^2.50.0-alpha.0",
- "@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.50.0-alpha.0",
- "@remotion/lambda": "^3.3.33",
- "aws-cdk-lib": "2.50.0",
- "constructs": "^10.1.147",
- "remotion": "^3.3.33",
- "semver": "7.3.5",
- "source-map-support": "^0.5.21"
- },
- "devDependencies": {
- "@types/aws-lambda": "^8.10.108",
- "@types/node": "^17.0.23",
- "@typescript-eslint/eslint-plugin": "^5.48.2",
- "@typescript-eslint/parser": "^5.48.2",
- "aws-cdk": "^2.50.0",
- "aws-lambda": "^1.0.7",
- "esbuild": "^0.15.12",
- "eslint": "^8.32.0",
- "eslint-config-airbnb-base": "^15.0.0",
- "eslint-config-prettier": "^8.5.0",
- "eslint-import-resolver-typescript": "^2.7.1",
- "eslint-plugin-import": "^2.26.0",
- "eslint-plugin-prettier": "^4.0.0",
- "prettier": "^2.6.2",
- "ts-node": "^10.7.0",
- "typescript": "^4.6.3"
- }
-}
diff --git a/packages/example-lambda/src/render-function/index.ts b/packages/example-lambda/src/render-function/index.ts
deleted file mode 100644
index 67adee979d..0000000000
--- a/packages/example-lambda/src/render-function/index.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/* eslint-disable @typescript-eslint/require-await */
-import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from "aws-lambda";
-import { renderMediaOnLambda } from "@remotion/lambda/client";
-
-export async function main(
- //@ts-ignore
- event: APIGatewayProxyEventV2
-): Promise<APIGatewayProxyResultV2> {
- try {
- const { bucketName, renderId } = await renderMediaOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- composition: "MyVideo",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
- codec: "h264",
- });
-
- return {
- body: JSON.stringify({ isSuccess: true, bucketName, renderId }),
- statusCode: 200,
- };
- } catch (ex) {
- return {
- body: JSON.stringify({ isSuccess: false, ex }),
- statusCode: 400,
- };
- }
-}
diff --git a/packages/example-lambda/tsconfig.eslint.json b/packages/example-lambda/tsconfig.eslint.json
deleted file mode 100644
index 058631ba69..0000000000
--- a/packages/example-lambda/tsconfig.eslint.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "extends": "./tsconfig.json",
- "include": [
- "src/**/*.ts",
- "src/**/*.js",
- "global-types/**/*",
- "**/*.js",
- "**/*.ts",
- "infra/**/*"
- ],
- "exclude": ["node_modules", "**/node_modules/*", "cdk.out"]
-}
diff --git a/packages/example-lambda/tsconfig.json b/packages/example-lambda/tsconfig.json
deleted file mode 100644
index 5a25817b19..0000000000
--- a/packages/example-lambda/tsconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "extends": "../tsconfig.settings.json",
- "compilerOptions": {
-
-
-
- "outDir": "./dist"
- },
- "exclude": ["node_modules", "**/node_modules/*", "cdk.out", "dist"]
-}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e96f5fff6b..f2161f5dc2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11698,7 +11698,7 @@ packages:
/babel-plugin-dynamic-import-node/2.3.3:
resolution: {integrity: sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==}
dependencies:
- object.assign: 4.1.2
+ object.assign: 4.1.4
/babel-plugin-extract-import-names/1.6.22:
resolution: {integrity: sha512-yJ9BsJaISua7d8zNT7oRG1ZLBJCIdZ4PZqmH8qa9N5AK01ifk3fnkc98AXhtzE7UkfCsEumvoQWgoYLhOnJ7jQ==}
@@ -14629,7 +14629,7 @@ packages:
confusing-browser-globals: 1.0.11
eslint: 8.32.0
eslint-plugin-import: 2.27.5_e3x2kyknr3siwrh36c72mqspke
- object.assign: 4.1.2
+ object.assign: 4.1.4
object.entries: 1.1.5
semver: 6.3.0
dev: true
@@ -16118,9 +16118,6 @@ packages:
engines: {node: '>=6'}
dev: false
- /has-bigints/1.0.1:
- resolution: {integrity: sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==}
-
/has-bigints/1.0.2:
resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==}
@@ -17508,14 +17505,14 @@ packages:
engines: {node: '>=4.0'}
dependencies:
array-includes: 3.1.4
- object.assign: 4.1.2
+ object.assign: 4.1.4
/jsx-ast-utils/3.2.1:
resolution: {integrity: sha512-uP5vu8xfy2F9A6LGC22KO7e2/vGTS1MhP+18f++ZNlf0Ohaxbc9nIEwHAsejlJKyzfZzU5UIhe5ItYkitcZnZA==}
engines: {node: '>=4.0'}
dependencies:
array-includes: 3.1.5
- object.assign: 4.1.2
+ object.assign: 4.1.4
/keyv/3.1.0:
resolution: {integrity: sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==}
@@ -19123,15 +19120,6 @@ packages:
dependencies:
isobject: 3.0.1
- /object.assign/4.1.2:
- resolution: {integrity: sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==}
- engines: {node: '>= 0.4'}
- dependencies:
- call-bind: 1.0.2
- define-properties: 1.1.4
- has-symbols: 1.0.3
- object-keys: 1.1.1
-
/object.assign/4.1.4:
resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==}
engines: {node: '>= 0.4'}
@@ -23617,7 +23605,7 @@ packages:
resolution: {integrity: sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==}
dependencies:
function-bind: 1.1.1
- has-bigints: 1.0.1
+ has-bigints: 1.0.2
has-symbols: 1.0.3
which-boxed-primitive: 1.0.2
@@ -24229,7 +24217,7 @@ packages:
dependencies:
'@types/chai': 4.3.3
'@types/chai-subset': 1.3.3
- '@types/node': 18.11.18
+ '@types/node': 18.11.2
chai: 4.3.6
debug: 4.3.4
jsdom: 20.0.1