@remotion/lambda 3.2.22 → 3.2.23-ensure-ffmpeg.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -8
- package/dist/admin/bundle-lambda.d.ts +0 -0
- package/dist/admin/bundle-lambda.js +0 -0
- package/dist/admin/make-layer-public.d.ts +0 -0
- package/dist/admin/make-layer-public.js +0 -0
- package/dist/api/bucket-exists.d.ts +0 -0
- package/dist/api/bucket-exists.js +1 -1
- package/dist/api/clean-items.d.ts +0 -0
- package/dist/api/clean-items.js +1 -1
- package/dist/api/create-bucket.d.ts +0 -0
- package/dist/api/create-bucket.js +1 -1
- package/dist/api/create-function.d.ts +0 -0
- package/dist/api/create-function.js +0 -0
- package/dist/api/delete-function.d.ts +0 -0
- package/dist/api/delete-function.js +0 -0
- package/dist/api/delete-render.d.ts +19 -0
- package/dist/api/delete-render.js +66 -0
- package/dist/api/delete-site.d.ts +0 -0
- package/dist/api/delete-site.js +0 -5
- package/dist/api/deploy-function.d.ts +0 -0
- package/dist/api/deploy-function.js +0 -0
- package/dist/api/deploy-site.d.ts +0 -0
- package/dist/api/deploy-site.js +0 -0
- package/dist/api/download-media.d.ts +13 -0
- package/dist/api/download-media.js +15 -3
- package/dist/api/enable-s3-website.d.ts +0 -0
- package/dist/api/enable-s3-website.js +1 -1
- package/dist/api/estimate-price.d.ts +0 -0
- package/dist/api/estimate-price.js +0 -0
- package/dist/api/get-aws-client.d.ts +4 -2
- package/dist/api/get-aws-client.js +7 -2
- package/dist/api/get-buckets.d.ts +0 -0
- package/dist/api/get-buckets.js +2 -2
- package/dist/api/get-function-info.d.ts +0 -0
- package/dist/api/get-function-info.js +0 -0
- package/dist/api/get-functions.d.ts +0 -0
- package/dist/api/get-functions.js +0 -0
- package/dist/api/get-or-create-bucket.d.ts +0 -0
- package/dist/api/get-or-create-bucket.js +0 -0
- package/dist/api/get-regions.d.ts +0 -0
- package/dist/api/get-regions.js +0 -0
- package/dist/api/get-render-progress.d.ts +4 -1
- package/dist/api/get-render-progress.js +3 -1
- package/dist/api/get-sites.d.ts +0 -0
- package/dist/api/get-sites.js +0 -0
- package/dist/api/iam-validation/role-permissions.d.ts +0 -0
- package/dist/api/iam-validation/role-permissions.js +0 -0
- package/dist/api/iam-validation/simulate-rule.d.ts +0 -0
- package/dist/api/iam-validation/simulate-rule.js +0 -0
- package/dist/api/iam-validation/simulate.d.ts +0 -0
- package/dist/api/iam-validation/simulate.js +0 -0
- package/dist/api/iam-validation/suggested-policy.d.ts +0 -0
- package/dist/api/iam-validation/suggested-policy.js +0 -0
- package/dist/api/iam-validation/user-permissions.d.ts +0 -0
- package/dist/api/iam-validation/user-permissions.js +0 -0
- package/dist/api/mock-functions.d.ts +0 -0
- package/dist/api/mock-functions.js +0 -0
- package/dist/api/presign-url.d.ts +0 -0
- package/dist/api/presign-url.js +1 -1
- package/dist/api/render-media-on-lambda.d.ts +21 -10
- package/dist/api/render-media-on-lambda.js +32 -12
- package/dist/api/render-still-on-lambda.d.ts +3 -1
- package/dist/api/render-still-on-lambda.js +12 -4
- package/dist/api/upload-dir.d.ts +0 -0
- package/dist/api/upload-dir.js +1 -1
- package/dist/api/validate-webhook-signature.d.ts +13 -0
- package/dist/api/validate-webhook-signature.js +32 -0
- package/dist/cli/args.d.ts +4 -2
- package/dist/cli/args.js +1 -5
- package/dist/cli/commands/functions/deploy.d.ts +0 -0
- package/dist/cli/commands/functions/deploy.js +0 -0
- package/dist/cli/commands/functions/index.d.ts +0 -0
- package/dist/cli/commands/functions/index.js +0 -0
- package/dist/cli/commands/functions/ls.d.ts +0 -0
- package/dist/cli/commands/functions/ls.js +0 -0
- package/dist/cli/commands/functions/rm.d.ts +0 -0
- package/dist/cli/commands/functions/rm.js +0 -0
- package/dist/cli/commands/functions/rmall.d.ts +0 -0
- package/dist/cli/commands/functions/rmall.js +0 -0
- package/dist/cli/commands/policies/policies.d.ts +0 -0
- package/dist/cli/commands/policies/policies.js +0 -0
- package/dist/cli/commands/policies/role.d.ts +0 -0
- package/dist/cli/commands/policies/role.js +0 -0
- package/dist/cli/commands/policies/user.d.ts +0 -0
- package/dist/cli/commands/policies/user.js +0 -0
- package/dist/cli/commands/policies/validate.d.ts +0 -0
- package/dist/cli/commands/policies/validate.js +0 -0
- package/dist/cli/commands/quotas/increase.d.ts +0 -0
- package/dist/cli/commands/quotas/increase.js +0 -0
- package/dist/cli/commands/quotas/index.d.ts +0 -0
- package/dist/cli/commands/quotas/index.js +0 -0
- package/dist/cli/commands/quotas/list.d.ts +0 -0
- package/dist/cli/commands/quotas/list.js +0 -0
- package/dist/cli/commands/regions.d.ts +0 -0
- package/dist/cli/commands/regions.js +0 -0
- package/dist/cli/commands/render/progress.d.ts +2 -1
- package/dist/cli/commands/render/progress.js +10 -3
- package/dist/cli/commands/render/render.d.ts +1 -1
- package/dist/cli/commands/render/render.js +44 -15
- package/dist/cli/commands/sites/create.d.ts +1 -1
- package/dist/cli/commands/sites/create.js +6 -4
- package/dist/cli/commands/sites/index.d.ts +1 -1
- package/dist/cli/commands/sites/index.js +2 -2
- package/dist/cli/commands/sites/ls.d.ts +0 -0
- package/dist/cli/commands/sites/ls.js +0 -0
- package/dist/cli/commands/sites/rm.d.ts +0 -0
- package/dist/cli/commands/sites/rm.js +0 -0
- package/dist/cli/commands/sites/rmall.d.ts +0 -0
- package/dist/cli/commands/sites/rmall.js +0 -0
- package/dist/cli/commands/still.d.ts +1 -1
- package/dist/cli/commands/still.js +36 -18
- package/dist/cli/get-aws-region.d.ts +0 -0
- package/dist/cli/get-aws-region.js +0 -0
- package/dist/cli/help.d.ts +0 -0
- package/dist/cli/help.js +0 -0
- package/dist/cli/helpers/confirm.d.ts +0 -0
- package/dist/cli/helpers/confirm.js +0 -0
- package/dist/cli/helpers/date-string.d.ts +0 -0
- package/dist/cli/helpers/date-string.js +0 -0
- package/dist/cli/helpers/find-function-name.d.ts +0 -0
- package/dist/cli/helpers/find-function-name.js +0 -0
- package/dist/cli/helpers/progress-bar.d.ts +0 -0
- package/dist/cli/helpers/progress-bar.js +0 -0
- package/dist/cli/helpers/quit.d.ts +0 -0
- package/dist/cli/helpers/quit.js +0 -0
- package/dist/cli/helpers/yes-or-no.d.ts +0 -0
- package/dist/cli/helpers/yes-or-no.js +0 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +10 -8
- package/dist/cli/is-cli.d.ts +0 -0
- package/dist/cli/is-cli.js +0 -0
- package/dist/cli/log.d.ts +0 -0
- package/dist/cli/log.js +0 -0
- package/dist/client.d.ts +4 -2
- package/dist/client.js +3 -1
- package/dist/defaults.d.ts +0 -0
- package/dist/defaults.js +0 -0
- package/dist/functions/chunk-optimization/can-use-optimization.d.ts +0 -0
- package/dist/functions/chunk-optimization/can-use-optimization.js +0 -0
- package/dist/functions/chunk-optimization/collect-data.d.ts +0 -0
- package/dist/functions/chunk-optimization/collect-data.js +0 -0
- package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.d.ts +0 -0
- package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.js +0 -0
- package/dist/functions/chunk-optimization/get-profile-duration.d.ts +0 -0
- package/dist/functions/chunk-optimization/get-profile-duration.js +0 -0
- package/dist/functions/chunk-optimization/is-valid-profile.d.ts +0 -0
- package/dist/functions/chunk-optimization/is-valid-profile.js +0 -0
- package/dist/functions/chunk-optimization/optimize-invocation-order.d.ts +0 -0
- package/dist/functions/chunk-optimization/optimize-invocation-order.js +0 -0
- package/dist/functions/chunk-optimization/optimize-profile.d.ts +0 -0
- package/dist/functions/chunk-optimization/optimize-profile.js +0 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -5
- package/dist/functions/chunk-optimization/plan-frame-ranges.js +1 -14
- package/dist/functions/chunk-optimization/s3-optimization-file.d.ts +0 -0
- package/dist/functions/chunk-optimization/s3-optimization-file.js +1 -0
- package/dist/functions/chunk-optimization/simulate-frame-ranges.d.ts +0 -0
- package/dist/functions/chunk-optimization/simulate-frame-ranges.js +0 -0
- package/dist/functions/chunk-optimization/sort-by-duration.d.ts +0 -0
- package/dist/functions/chunk-optimization/sort-by-duration.js +0 -0
- package/dist/functions/chunk-optimization/types.d.ts +0 -11
- package/dist/functions/chunk-optimization/types.js +0 -0
- package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +0 -0
- package/dist/functions/helpers/best-frames-per-lambda-param.js +0 -0
- package/dist/functions/helpers/calculate-chunk-times.d.ts +0 -0
- package/dist/functions/helpers/calculate-chunk-times.js +0 -0
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +0 -0
- package/dist/functions/helpers/calculate-price-from-bucket.js +0 -0
- package/dist/functions/helpers/check-if-render-exists.d.ts +0 -0
- package/dist/functions/helpers/check-if-render-exists.js +0 -0
- package/dist/functions/helpers/clean-tmpdir.d.ts +0 -0
- package/dist/functions/helpers/clean-tmpdir.js +1 -1
- package/dist/functions/helpers/concat-videos.d.ts +6 -1
- package/dist/functions/helpers/concat-videos.js +27 -9
- package/dist/functions/helpers/create-post-render-data.d.ts +0 -0
- package/dist/functions/helpers/create-post-render-data.js +0 -0
- package/dist/functions/helpers/delete-chunks.d.ts +0 -0
- package/dist/functions/helpers/delete-chunks.js +0 -0
- package/dist/functions/helpers/expected-out-name.d.ts +4 -2
- package/dist/functions/helpers/expected-out-name.js +26 -5
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +3 -1
- package/dist/functions/helpers/find-output-file-in-bucket.js +12 -10
- package/dist/functions/helpers/format-costs-info.d.ts +0 -0
- package/dist/functions/helpers/format-costs-info.js +0 -0
- package/dist/functions/helpers/get-browser-instance.d.ts +0 -0
- package/dist/functions/helpers/get-browser-instance.js +0 -0
- package/dist/functions/helpers/get-chromium-executable-path.d.ts +0 -0
- package/dist/functions/helpers/get-chromium-executable-path.js +0 -0
- package/dist/functions/helpers/get-cleanup-progress.d.ts +0 -0
- package/dist/functions/helpers/get-cleanup-progress.js +0 -0
- package/dist/functions/helpers/get-current-architecture.d.ts +0 -0
- package/dist/functions/helpers/get-current-architecture.js +0 -0
- package/dist/functions/helpers/get-current-region.d.ts +0 -0
- package/dist/functions/helpers/get-current-region.js +0 -0
- package/dist/functions/helpers/get-custom-out-name.d.ts +6 -0
- package/dist/functions/helpers/get-custom-out-name.js +31 -0
- package/dist/functions/helpers/get-encoding-metadata.d.ts +0 -0
- package/dist/functions/helpers/get-encoding-metadata.js +0 -0
- package/dist/functions/helpers/get-files-in-folder.d.ts +0 -0
- package/dist/functions/helpers/get-files-in-folder.js +0 -0
- package/dist/functions/helpers/get-files-to-delete.d.ts +0 -0
- package/dist/functions/helpers/get-files-to-delete.js +0 -0
- package/dist/functions/helpers/get-final-encoding-status.d.ts +0 -0
- package/dist/functions/helpers/get-final-encoding-status.js +0 -0
- package/dist/functions/helpers/get-folder-size.d.ts +0 -0
- package/dist/functions/helpers/get-folder-size.js +0 -0
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +0 -0
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +0 -0
- package/dist/functions/helpers/get-output-url-from-metadata.d.ts +2 -1
- package/dist/functions/helpers/get-output-url-from-metadata.js +2 -2
- package/dist/functions/helpers/get-overall-progress.d.ts +0 -0
- package/dist/functions/helpers/get-overall-progress.js +0 -0
- package/dist/functions/helpers/get-post-render-data.d.ts +0 -0
- package/dist/functions/helpers/get-post-render-data.js +0 -0
- package/dist/functions/helpers/get-progress.d.ts +4 -2
- package/dist/functions/helpers/get-progress.js +8 -6
- package/dist/functions/helpers/get-render-metadata.d.ts +0 -0
- package/dist/functions/helpers/get-render-metadata.js +0 -0
- package/dist/functions/helpers/get-retry-stats.d.ts +0 -0
- package/dist/functions/helpers/get-retry-stats.js +0 -0
- package/dist/functions/helpers/get-time-to-finish.d.ts +0 -0
- package/dist/functions/helpers/get-time-to-finish.js +0 -0
- package/dist/functions/helpers/inspect-errors.d.ts +0 -0
- package/dist/functions/helpers/inspect-errors.js +0 -0
- package/dist/functions/helpers/io.d.ts +13 -2
- package/dist/functions/helpers/io.js +19 -9
- package/dist/functions/helpers/is-enosp-err.d.ts +0 -0
- package/dist/functions/helpers/is-enosp-err.js +0 -0
- package/dist/functions/helpers/is-warm.d.ts +0 -0
- package/dist/functions/helpers/is-warm.js +0 -0
- package/dist/functions/helpers/min-max.d.ts +0 -0
- package/dist/functions/helpers/min-max.js +0 -0
- package/dist/functions/helpers/print-cloudwatch-helper.d.ts +0 -0
- package/dist/functions/helpers/print-cloudwatch-helper.js +0 -0
- package/dist/functions/helpers/print-concurrency-curve.d.ts +0 -0
- package/dist/functions/helpers/print-concurrency-curve.js +0 -0
- package/dist/functions/helpers/read-with-progress.d.ts +3 -1
- package/dist/functions/helpers/read-with-progress.js +3 -3
- package/dist/functions/helpers/timer.d.ts +0 -0
- package/dist/functions/helpers/timer.js +0 -0
- package/dist/functions/helpers/validate-composition.d.ts +3 -1
- package/dist/functions/helpers/validate-composition.js +6 -2
- package/dist/functions/helpers/write-lambda-error.d.ts +1 -1
- package/dist/functions/helpers/write-lambda-error.js +1 -0
- package/dist/functions/helpers/write-post-render-data.d.ts +0 -0
- package/dist/functions/helpers/write-post-render-data.js +1 -0
- package/dist/functions/index.d.ts +0 -0
- package/dist/functions/index.js +6 -3
- package/dist/functions/info.d.ts +0 -0
- package/dist/functions/info.js +0 -0
- package/dist/functions/launch.d.ts +1 -0
- package/dist/functions/launch.js +237 -73
- package/dist/functions/progress.d.ts +1 -1
- package/dist/functions/progress.js +5 -3
- package/dist/functions/renderer.d.ts +0 -0
- package/dist/functions/renderer.js +25 -2
- package/dist/functions/start.d.ts +0 -0
- package/dist/functions/start.js +9 -2
- package/dist/functions/still.d.ts +0 -0
- package/dist/functions/still.js +34 -10
- package/dist/index.d.ts +8 -2
- package/dist/index.js +5 -1
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +0 -0
- package/dist/pricing/aws-regions.d.ts +0 -0
- package/dist/pricing/aws-regions.js +0 -0
- package/dist/pricing/price-per-1-s.d.ts +0 -0
- package/dist/pricing/price-per-1-s.js +0 -0
- package/dist/regions.d.ts +0 -0
- package/dist/regions.js +0 -0
- package/dist/shared/await.d.ts +0 -0
- package/dist/shared/await.js +0 -0
- package/dist/shared/aws-clients.d.ts +13 -2
- package/dist/shared/aws-clients.js +56 -26
- package/dist/shared/bundle-site.d.ts +0 -0
- package/dist/shared/bundle-site.js +0 -0
- package/dist/shared/call-lambda.d.ts +0 -0
- package/dist/shared/call-lambda.js +0 -0
- package/dist/shared/check-credentials.d.ts +0 -0
- package/dist/shared/check-credentials.js +0 -0
- package/dist/shared/cleanup-serialized-input-props.d.ts +7 -0
- package/dist/shared/cleanup-serialized-input-props.js +19 -0
- package/dist/shared/constants.d.ts +45 -8
- package/dist/shared/constants.js +12 -4
- package/dist/shared/content-disposition-header.d.ts +0 -0
- package/dist/shared/content-disposition-header.js +0 -0
- package/dist/shared/convert-to-serve-url.d.ts +0 -0
- package/dist/shared/convert-to-serve-url.js +0 -0
- package/dist/shared/deserialize-input-props.d.ts +8 -0
- package/dist/shared/deserialize-input-props.js +26 -0
- package/dist/shared/docs-url.d.ts +0 -0
- package/dist/shared/docs-url.js +0 -0
- package/dist/shared/function-zip-path.d.ts +0 -0
- package/dist/shared/function-zip-path.js +0 -0
- package/dist/shared/get-account-id.d.ts +0 -0
- package/dist/shared/get-account-id.js +0 -0
- package/dist/{cli/helpers/get-cloudwatch-stream-url.d.ts → shared/get-aws-url.d.ts} +2 -2
- package/dist/{cli/helpers/get-cloudwatch-stream-url.js → shared/get-aws-url.js} +0 -0
- package/dist/shared/get-aws-urls.d.ts +13 -0
- package/dist/shared/get-aws-urls.js +11 -0
- package/dist/shared/get-cloudwatch-stream-url.d.ts +0 -0
- package/dist/shared/get-cloudwatch-stream-url.js +0 -0
- package/dist/shared/get-function-version.d.ts +0 -0
- package/dist/shared/get-function-version.js +0 -0
- package/dist/shared/get-most-expensive-chunks.d.ts +0 -0
- package/dist/shared/get-most-expensive-chunks.js +0 -0
- package/dist/shared/hosted-layers.d.ts +0 -0
- package/dist/shared/hosted-layers.js +0 -0
- package/dist/shared/invoke-webhook.d.ts +44 -0
- package/dist/shared/invoke-webhook.js +89 -0
- package/dist/shared/is-in-lambda.d.ts +0 -0
- package/dist/shared/is-in-lambda.js +0 -0
- package/dist/shared/lambda-version-string.d.ts +0 -0
- package/dist/shared/lambda-version-string.js +0 -0
- package/dist/shared/make-s3-key.d.ts +0 -0
- package/dist/shared/make-s3-key.js +0 -0
- package/dist/shared/make-s3-url.d.ts +0 -0
- package/dist/shared/make-s3-url.js +0 -0
- package/dist/shared/p-limit.d.ts +0 -0
- package/dist/shared/p-limit.js +0 -0
- package/dist/shared/parse-lambda-initialized-key.d.ts +0 -0
- package/dist/shared/parse-lambda-initialized-key.js +0 -0
- package/dist/shared/parse-lambda-timings-key.d.ts +0 -0
- package/dist/shared/parse-lambda-timings-key.js +0 -0
- package/dist/shared/random-hash.d.ts +0 -0
- package/dist/shared/random-hash.js +0 -0
- package/dist/shared/return-values.d.ts +0 -0
- package/dist/shared/return-values.js +0 -0
- package/dist/shared/serialize-input-props.d.ts +7 -0
- package/dist/shared/serialize-input-props.js +42 -0
- package/dist/shared/sleep.d.ts +0 -0
- package/dist/shared/sleep.js +0 -0
- package/dist/shared/stream-to-string.d.ts +0 -0
- package/dist/shared/stream-to-string.js +0 -0
- package/dist/shared/truthy.d.ts +0 -0
- package/dist/shared/truthy.js +0 -0
- package/dist/shared/validate-architecture.d.ts +0 -0
- package/dist/shared/validate-architecture.js +0 -0
- package/dist/shared/validate-aws-region.d.ts +0 -0
- package/dist/shared/validate-aws-region.js +0 -0
- package/dist/shared/validate-bucketname.d.ts +0 -0
- package/dist/shared/validate-bucketname.js +0 -0
- package/dist/shared/validate-custom-role-arn.d.ts +0 -0
- package/dist/shared/validate-custom-role-arn.js +0 -0
- package/dist/shared/validate-disk-size-in-mb.d.ts +0 -0
- package/dist/shared/validate-disk-size-in-mb.js +0 -0
- package/dist/shared/validate-download-behavior.d.ts +0 -0
- package/dist/shared/validate-download-behavior.js +0 -0
- package/dist/shared/validate-frames-per-lambda.d.ts +0 -0
- package/dist/shared/validate-frames-per-lambda.js +0 -0
- package/dist/shared/validate-lambda-codec.d.ts +0 -0
- package/dist/shared/validate-lambda-codec.js +0 -0
- package/dist/shared/validate-memory-size.d.ts +0 -0
- package/dist/shared/validate-memory-size.js +0 -0
- package/dist/shared/validate-outname.d.ts +3 -2
- package/dist/shared/validate-outname.js +5 -1
- package/dist/shared/validate-presign-expiration.d.ts +0 -0
- package/dist/shared/validate-presign-expiration.js +0 -0
- package/dist/shared/validate-privacy.d.ts +0 -0
- package/dist/shared/validate-privacy.js +0 -0
- package/dist/shared/validate-retention-period.d.ts +0 -0
- package/dist/shared/validate-retention-period.js +0 -0
- package/dist/shared/validate-retries.d.ts +0 -0
- package/dist/shared/validate-retries.js +0 -0
- package/dist/shared/validate-serveurl.d.ts +0 -0
- package/dist/shared/validate-serveurl.js +0 -0
- package/dist/shared/validate-site-name.d.ts +0 -0
- package/dist/shared/validate-site-name.js +0 -0
- package/dist/shared/validate-timeout.d.ts +0 -0
- package/dist/shared/validate-timeout.js +0 -0
- package/package.json +19 -22
- package/remotionlambda.zip +0 -0
package/dist/functions/launch.js
CHANGED
|
@@ -10,25 +10,22 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
11
|
const version_1 = require("remotion/version");
|
|
12
12
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
13
|
+
const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
|
|
13
14
|
const constants_1 = require("../shared/constants");
|
|
15
|
+
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
14
16
|
const docs_url_1 = require("../shared/docs-url");
|
|
17
|
+
const invoke_webhook_1 = require("../shared/invoke-webhook");
|
|
15
18
|
const make_s3_url_1 = require("../shared/make-s3-url");
|
|
16
19
|
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
17
20
|
const validate_outname_1 = require("../shared/validate-outname");
|
|
18
21
|
const validate_privacy_1 = require("../shared/validate-privacy");
|
|
19
|
-
const collect_data_1 = require("./chunk-optimization/collect-data");
|
|
20
|
-
const get_frame_ranges_from_profile_1 = require("./chunk-optimization/get-frame-ranges-from-profile");
|
|
21
|
-
const get_profile_duration_1 = require("./chunk-optimization/get-profile-duration");
|
|
22
|
-
const is_valid_profile_1 = require("./chunk-optimization/is-valid-profile");
|
|
23
|
-
const optimize_invocation_order_1 = require("./chunk-optimization/optimize-invocation-order");
|
|
24
|
-
const optimize_profile_1 = require("./chunk-optimization/optimize-profile");
|
|
25
22
|
const plan_frame_ranges_1 = require("./chunk-optimization/plan-frame-ranges");
|
|
26
|
-
const s3_optimization_file_1 = require("./chunk-optimization/s3-optimization-file");
|
|
27
23
|
const best_frames_per_lambda_param_1 = require("./helpers/best-frames-per-lambda-param");
|
|
28
24
|
const concat_videos_1 = require("./helpers/concat-videos");
|
|
29
25
|
const create_post_render_data_1 = require("./helpers/create-post-render-data");
|
|
30
26
|
const delete_chunks_1 = require("./helpers/delete-chunks");
|
|
31
27
|
const expected_out_name_1 = require("./helpers/expected-out-name");
|
|
28
|
+
const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-bucket");
|
|
32
29
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
33
30
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
34
31
|
const get_files_to_delete_1 = require("./helpers/get-files-to-delete");
|
|
@@ -62,27 +59,69 @@ const callFunctionWithRetry = async (payload, retries = 0) => {
|
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
61
|
const innerLaunchHandler = async (params, options) => {
|
|
65
|
-
var _a, _b;
|
|
62
|
+
var _a, _b, _c, _d;
|
|
66
63
|
if (params.type !== constants_1.LambdaRoutines.launch) {
|
|
67
64
|
throw new Error('Expected launch type');
|
|
68
65
|
}
|
|
69
66
|
const startedDate = Date.now();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
let webhookInvoked = false;
|
|
68
|
+
console.log(`Function has ${Math.max(options.getRemainingTimeInMillis() - 1000, 1000)} before it times out`);
|
|
69
|
+
const verbose = renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose');
|
|
70
|
+
const webhookDueToTimeout = setTimeout(async () => {
|
|
71
|
+
if (params.webhook && !webhookInvoked) {
|
|
72
|
+
try {
|
|
73
|
+
await (0, invoke_webhook_1.invokeWebhook)({
|
|
74
|
+
url: params.webhook.url,
|
|
75
|
+
secret: params.webhook.secret,
|
|
76
|
+
payload: {
|
|
77
|
+
type: 'timeout',
|
|
78
|
+
renderId: params.renderId,
|
|
79
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
80
|
+
bucketName: params.bucketName,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
webhookInvoked = true;
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
if (process.env.NODE_ENV === 'test') {
|
|
87
|
+
throw err;
|
|
88
|
+
}
|
|
89
|
+
await (0, write_lambda_error_1.writeLambdaError)({
|
|
90
|
+
bucketName: params.bucketName,
|
|
91
|
+
errorInfo: {
|
|
92
|
+
type: 'webhook',
|
|
93
|
+
message: err.message,
|
|
94
|
+
name: err.name,
|
|
95
|
+
stack: err.stack,
|
|
96
|
+
tmpDir: null,
|
|
97
|
+
frame: 0,
|
|
98
|
+
chunk: 0,
|
|
99
|
+
isFatal: false,
|
|
100
|
+
attempt: 1,
|
|
101
|
+
willRetry: false,
|
|
102
|
+
totalAttempts: 1,
|
|
103
|
+
},
|
|
104
|
+
renderId: params.renderId,
|
|
105
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
106
|
+
});
|
|
107
|
+
console.log('Failed to invoke webhook:');
|
|
108
|
+
console.log(err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, Math.max(options.getRemainingTimeInMillis() - 1000, 1000));
|
|
112
|
+
const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(verbose, params.chromiumOptions);
|
|
80
113
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
114
|
+
const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
|
|
115
|
+
bucketName: params.bucketName,
|
|
116
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
117
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
118
|
+
serialized: params.inputProps,
|
|
119
|
+
});
|
|
81
120
|
const comp = await (0, validate_composition_1.validateComposition)({
|
|
82
121
|
serveUrl: params.serveUrl,
|
|
83
122
|
composition: params.composition,
|
|
84
123
|
browserInstance,
|
|
85
|
-
inputProps:
|
|
124
|
+
inputProps: await inputPropsPromise,
|
|
86
125
|
envVariables: params.envVariables,
|
|
87
126
|
ffmpegExecutable: null,
|
|
88
127
|
ffprobeExecutable: null,
|
|
@@ -90,11 +129,15 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
90
129
|
chromiumOptions: params.chromiumOptions,
|
|
91
130
|
port: null,
|
|
92
131
|
downloadMap,
|
|
132
|
+
forceHeight: params.forceHeight,
|
|
133
|
+
forceWidth: params.forceWidth,
|
|
93
134
|
});
|
|
94
135
|
remotion_1.Internals.validateDurationInFrames(comp.durationInFrames, 'passed to a Lambda render');
|
|
95
136
|
remotion_1.Internals.validateFps(comp.fps, 'passed to a Lambda render', false);
|
|
96
137
|
remotion_1.Internals.validateDimension(comp.height, 'height', 'passed to a Lambda render');
|
|
97
138
|
remotion_1.Internals.validateDimension(comp.width, 'width', 'passed to a Lambda render');
|
|
139
|
+
renderer_1.RenderInternals.validateBitrate(params.audioBitrate, 'audioBitrate');
|
|
140
|
+
renderer_1.RenderInternals.validateBitrate(params.videoBitrate, 'videoBitrate');
|
|
98
141
|
renderer_1.RenderInternals.validateConcurrency(params.concurrencyPerLambda, 'concurrencyPerLambda');
|
|
99
142
|
const realFrameRange = renderer_1.RenderInternals.getRealFrameRange(comp.durationInFrames, params.frameRange);
|
|
100
143
|
const frameCount = renderer_1.RenderInternals.getFramesToRender(realFrameRange, params.everyNthFrame);
|
|
@@ -107,14 +150,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
107
150
|
if (chunkCount > constants_1.MAX_FUNCTIONS_PER_RENDER) {
|
|
108
151
|
throw new Error(`Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${constants_1.MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${docs_url_1.DOCS_URL}/docs/lambda/concurrency for how this parameter is calculated.`);
|
|
109
152
|
}
|
|
110
|
-
(0, validate_outname_1.validateOutname)(params.outName);
|
|
153
|
+
(0, validate_outname_1.validateOutname)(params.outName, params.codec);
|
|
111
154
|
(0, validate_privacy_1.validatePrivacy)(params.privacy);
|
|
112
155
|
renderer_1.RenderInternals.validatePuppeteerTimeout(params.timeoutInMilliseconds);
|
|
113
|
-
const { chunks
|
|
156
|
+
const { chunks } = (0, plan_frame_ranges_1.planFrameRanges)({
|
|
114
157
|
framesPerLambda,
|
|
115
|
-
optimization,
|
|
116
|
-
// TODO: Re-enable chunk optimization later
|
|
117
|
-
shouldUseOptimization: false,
|
|
118
158
|
frameRange: realFrameRange,
|
|
119
159
|
everyNthFrame: params.everyNthFrame,
|
|
120
160
|
});
|
|
@@ -153,6 +193,8 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
153
193
|
everyNthFrame: params.everyNthFrame,
|
|
154
194
|
concurrencyPerLambda: params.concurrencyPerLambda,
|
|
155
195
|
muted: params.muted,
|
|
196
|
+
audioBitrate: params.audioBitrate,
|
|
197
|
+
videoBitrate: params.videoBitrate,
|
|
156
198
|
};
|
|
157
199
|
return payload;
|
|
158
200
|
});
|
|
@@ -171,7 +213,6 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
171
213
|
compositionId: comp.id,
|
|
172
214
|
siteId: (0, make_s3_url_1.getServeUrlHash)(params.serveUrl),
|
|
173
215
|
codec: params.codec,
|
|
174
|
-
usesOptimizationProfile: didUseOptimization,
|
|
175
216
|
type: 'video',
|
|
176
217
|
imageFormat: params.imageFormat,
|
|
177
218
|
inputProps: params.inputProps,
|
|
@@ -181,7 +222,31 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
181
222
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
182
223
|
renderId: params.renderId,
|
|
183
224
|
outName: (_b = params.outName) !== null && _b !== void 0 ? _b : undefined,
|
|
225
|
+
privacy: params.privacy,
|
|
184
226
|
};
|
|
227
|
+
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
228
|
+
? null
|
|
229
|
+
: (_d = (_c = params.outName) === null || _c === void 0 ? void 0 : _c.s3OutputProvider) !== null && _d !== void 0 ? _d : null);
|
|
230
|
+
const output = await (0, find_output_file_in_bucket_1.findOutputFileInBucket)({
|
|
231
|
+
bucketName: params.bucketName,
|
|
232
|
+
customCredentials,
|
|
233
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
234
|
+
renderMetadata,
|
|
235
|
+
});
|
|
236
|
+
if (output) {
|
|
237
|
+
if (params.overwrite) {
|
|
238
|
+
console.info('Deleting', { bucketName: renderBucketName, key }, 'because it already existed and will be overwritten');
|
|
239
|
+
await (0, io_1.lambdaDeleteFile)({
|
|
240
|
+
bucketName: renderBucketName,
|
|
241
|
+
customCredentials,
|
|
242
|
+
key,
|
|
243
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
throw new TypeError(`Output file "${key}" in bucket "${renderBucketName}" in region "${(0, get_current_region_1.getCurrentRegionInFunction)()}" already exists. Delete it before re-rendering, or use the overwrite option to delete it before render."`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
185
250
|
await (0, io_1.lambdaWriteFile)({
|
|
186
251
|
bucketName: params.bucketName,
|
|
187
252
|
key: (0, constants_1.renderMetadataKey)(params.renderId),
|
|
@@ -190,6 +255,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
190
255
|
privacy: 'private',
|
|
191
256
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
192
257
|
downloadBehavior: null,
|
|
258
|
+
customCredentials: null,
|
|
193
259
|
});
|
|
194
260
|
await Promise.all(lambdaPayloads.map(async (payload, index) => {
|
|
195
261
|
const callingLambdaTimer = (0, timer_1.timer)('Calling chunk ' + index);
|
|
@@ -223,6 +289,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
223
289
|
privacy: 'private',
|
|
224
290
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
225
291
|
downloadBehavior: null,
|
|
292
|
+
customCredentials: null,
|
|
226
293
|
}).catch((err) => {
|
|
227
294
|
(0, write_lambda_error_1.writeLambdaError)({
|
|
228
295
|
bucketName: params.bucketName,
|
|
@@ -244,6 +311,32 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
244
311
|
});
|
|
245
312
|
});
|
|
246
313
|
};
|
|
314
|
+
const onErrors = async (errors) => {
|
|
315
|
+
var _a;
|
|
316
|
+
console.log('Found Errors', errors);
|
|
317
|
+
if (params.webhook) {
|
|
318
|
+
console.log('Sending webhook with errors');
|
|
319
|
+
await (0, invoke_webhook_1.invokeWebhook)({
|
|
320
|
+
url: params.webhook.url,
|
|
321
|
+
secret: (_a = params.webhook.secret) !== null && _a !== void 0 ? _a : null,
|
|
322
|
+
payload: {
|
|
323
|
+
type: 'error',
|
|
324
|
+
renderId: params.renderId,
|
|
325
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
326
|
+
bucketName: params.bucketName,
|
|
327
|
+
errors: errors.slice(0, 5).map((e) => ({
|
|
328
|
+
message: e.message,
|
|
329
|
+
name: e.name,
|
|
330
|
+
stack: e.stack,
|
|
331
|
+
})),
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
console.log('No webhook specified');
|
|
337
|
+
}
|
|
338
|
+
throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
|
|
339
|
+
};
|
|
247
340
|
const fps = comp.fps / params.everyNthFrame;
|
|
248
341
|
const { outfile, cleanupChunksProm, encodingStart } = await (0, concat_videos_1.concatVideosS3)({
|
|
249
342
|
bucket: params.bucketName,
|
|
@@ -256,11 +349,13 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
256
349
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
257
350
|
fps,
|
|
258
351
|
numberOfGifLoops: params.numberOfGifLoops,
|
|
352
|
+
ffmpegExecutable: null,
|
|
353
|
+
remotionRoot: process.cwd(),
|
|
354
|
+
onErrors,
|
|
259
355
|
});
|
|
260
356
|
if (!encodingStop) {
|
|
261
357
|
encodingStop = Date.now();
|
|
262
358
|
}
|
|
263
|
-
const { key, renderBucketName } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName);
|
|
264
359
|
const outputSize = fs_1.default.statSync(outfile);
|
|
265
360
|
await (0, io_1.lambdaWriteFile)({
|
|
266
361
|
bucketName: renderBucketName,
|
|
@@ -270,48 +365,14 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
270
365
|
privacy: params.privacy,
|
|
271
366
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
272
367
|
downloadBehavior: params.downloadBehavior,
|
|
368
|
+
customCredentials,
|
|
369
|
+
});
|
|
370
|
+
const contents = await (0, io_1.lambdaLs)({
|
|
371
|
+
bucketName: params.bucketName,
|
|
372
|
+
prefix: (0, constants_1.rendersPrefix)(params.renderId),
|
|
373
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
374
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
273
375
|
});
|
|
274
|
-
let chunkProm = Promise.resolve();
|
|
275
|
-
// TODO: Enable in a later release
|
|
276
|
-
const enableChunkOptimization = false;
|
|
277
|
-
if (enableChunkOptimization) {
|
|
278
|
-
const chunkData = await (0, collect_data_1.collectChunkInformation)({
|
|
279
|
-
bucketName: params.bucketName,
|
|
280
|
-
renderId: params.renderId,
|
|
281
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
282
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
283
|
-
});
|
|
284
|
-
const optimizedProfile = (0, optimize_invocation_order_1.optimizeInvocationOrder)((0, optimize_profile_1.optimizeProfileRecursively)(chunkData, 400));
|
|
285
|
-
const optimizedFrameRange = (0, get_frame_ranges_from_profile_1.getFrameRangesFromProfile)(optimizedProfile);
|
|
286
|
-
chunkProm = (0, is_valid_profile_1.isValidOptimizationProfile)(optimizedProfile)
|
|
287
|
-
? (0, s3_optimization_file_1.writeOptimization)({
|
|
288
|
-
bucketName: params.bucketName,
|
|
289
|
-
optimization: {
|
|
290
|
-
ranges: optimizedFrameRange,
|
|
291
|
-
oldTiming: (0, get_profile_duration_1.getProfileDuration)(chunkData),
|
|
292
|
-
newTiming: (0, get_profile_duration_1.getProfileDuration)(optimizedProfile),
|
|
293
|
-
createdFromRenderId: params.renderId,
|
|
294
|
-
framesPerLambda,
|
|
295
|
-
lambdaVersion: version_1.VERSION,
|
|
296
|
-
frameRange: realFrameRange,
|
|
297
|
-
everyNthFrame: params.everyNthFrame,
|
|
298
|
-
},
|
|
299
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
300
|
-
compositionId: params.composition,
|
|
301
|
-
siteId: (0, make_s3_url_1.getServeUrlHash)(params.serveUrl),
|
|
302
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
303
|
-
})
|
|
304
|
-
: Promise.resolve();
|
|
305
|
-
}
|
|
306
|
-
const [, contents] = await Promise.all([
|
|
307
|
-
chunkProm,
|
|
308
|
-
(0, io_1.lambdaLs)({
|
|
309
|
-
bucketName: params.bucketName,
|
|
310
|
-
prefix: (0, constants_1.rendersPrefix)(params.renderId),
|
|
311
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
312
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
313
|
-
}),
|
|
314
|
-
]);
|
|
315
376
|
const finalEncodingProgress = {
|
|
316
377
|
framesEncoded: frameCount.length,
|
|
317
378
|
totalFrames: frameCount.length,
|
|
@@ -332,6 +393,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
332
393
|
privacy: 'private',
|
|
333
394
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
334
395
|
downloadBehavior: null,
|
|
396
|
+
customCredentials: null,
|
|
335
397
|
});
|
|
336
398
|
const errorExplanationsProm = (0, inspect_errors_1.inspectErrors)({
|
|
337
399
|
contents,
|
|
@@ -344,12 +406,20 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
344
406
|
chunkCount,
|
|
345
407
|
renderId: params.renderId,
|
|
346
408
|
});
|
|
347
|
-
const deletProm =
|
|
409
|
+
const deletProm = verbose
|
|
410
|
+
? Promise.resolve(0)
|
|
411
|
+
: (0, delete_chunks_1.cleanupFiles)({
|
|
412
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
413
|
+
bucket: params.bucketName,
|
|
414
|
+
contents,
|
|
415
|
+
jobs,
|
|
416
|
+
});
|
|
417
|
+
const cleanupSerializedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
|
|
418
|
+
bucketName: params.bucketName,
|
|
348
419
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
349
|
-
|
|
350
|
-
contents,
|
|
351
|
-
jobs,
|
|
420
|
+
serialized: params.inputProps,
|
|
352
421
|
});
|
|
422
|
+
const outputUrl = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, params.bucketName, customCredentials);
|
|
353
423
|
const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
|
|
354
424
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
355
425
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
@@ -359,11 +429,11 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
359
429
|
contents,
|
|
360
430
|
errorExplanations: await errorExplanationsProm,
|
|
361
431
|
timeToEncode: encodingStop - encodingStart,
|
|
362
|
-
timeToDelete: await deletProm,
|
|
432
|
+
timeToDelete: (await Promise.all([deletProm, cleanupSerializedInputPropsProm])).reduce((a, b) => a + b, 0),
|
|
363
433
|
outputFile: {
|
|
364
434
|
lastModified: Date.now(),
|
|
365
435
|
size: outputSize.size,
|
|
366
|
-
url:
|
|
436
|
+
url: outputUrl,
|
|
367
437
|
},
|
|
368
438
|
});
|
|
369
439
|
await finalEncodingProgressProm;
|
|
@@ -378,10 +448,57 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
378
448
|
bucketName: params.bucketName,
|
|
379
449
|
key: (0, constants_1.initalizedMetadataKey)(params.renderId),
|
|
380
450
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
451
|
+
customCredentials: null,
|
|
381
452
|
});
|
|
382
453
|
await Promise.all([cleanupChunksProm, fs_1.default.promises.rm(outfile)]);
|
|
454
|
+
clearTimeout(webhookDueToTimeout);
|
|
455
|
+
if (params.webhook && !webhookInvoked) {
|
|
456
|
+
try {
|
|
457
|
+
await (0, invoke_webhook_1.invokeWebhook)({
|
|
458
|
+
url: params.webhook.url,
|
|
459
|
+
secret: params.webhook.secret,
|
|
460
|
+
payload: {
|
|
461
|
+
type: 'success',
|
|
462
|
+
renderId: params.renderId,
|
|
463
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
464
|
+
bucketName: params.bucketName,
|
|
465
|
+
outputUrl,
|
|
466
|
+
lambdaErrors: postRenderData.errors,
|
|
467
|
+
outputFile: postRenderData.outputFile,
|
|
468
|
+
timeToFinish: postRenderData.timeToFinish,
|
|
469
|
+
},
|
|
470
|
+
});
|
|
471
|
+
webhookInvoked = true;
|
|
472
|
+
}
|
|
473
|
+
catch (err) {
|
|
474
|
+
if (process.env.NODE_ENV === 'test') {
|
|
475
|
+
throw err;
|
|
476
|
+
}
|
|
477
|
+
await (0, write_lambda_error_1.writeLambdaError)({
|
|
478
|
+
bucketName: params.bucketName,
|
|
479
|
+
errorInfo: {
|
|
480
|
+
type: 'webhook',
|
|
481
|
+
message: err.message,
|
|
482
|
+
name: err.name,
|
|
483
|
+
stack: err.stack,
|
|
484
|
+
tmpDir: null,
|
|
485
|
+
frame: 0,
|
|
486
|
+
chunk: 0,
|
|
487
|
+
isFatal: false,
|
|
488
|
+
attempt: 1,
|
|
489
|
+
willRetry: false,
|
|
490
|
+
totalAttempts: 1,
|
|
491
|
+
},
|
|
492
|
+
renderId: params.renderId,
|
|
493
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
494
|
+
});
|
|
495
|
+
console.log('Failed to invoke webhook:');
|
|
496
|
+
console.log(err);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
383
499
|
};
|
|
384
500
|
const launchHandler = async (params, options) => {
|
|
501
|
+
var _a, _b;
|
|
385
502
|
if (params.type !== constants_1.LambdaRoutines.launch) {
|
|
386
503
|
throw new Error('Expected launch type');
|
|
387
504
|
}
|
|
@@ -389,6 +506,9 @@ const launchHandler = async (params, options) => {
|
|
|
389
506
|
await innerLaunchHandler(params, options);
|
|
390
507
|
}
|
|
391
508
|
catch (err) {
|
|
509
|
+
if (process.env.NODE_ENV === 'test') {
|
|
510
|
+
throw err;
|
|
511
|
+
}
|
|
392
512
|
console.log('Error occurred', err);
|
|
393
513
|
await (0, write_lambda_error_1.writeLambdaError)({
|
|
394
514
|
bucketName: params.bucketName,
|
|
@@ -408,6 +528,50 @@ const launchHandler = async (params, options) => {
|
|
|
408
528
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
409
529
|
renderId: params.renderId,
|
|
410
530
|
});
|
|
531
|
+
if ((_a = params.webhook) === null || _a === void 0 ? void 0 : _a.url) {
|
|
532
|
+
try {
|
|
533
|
+
await (0, invoke_webhook_1.invokeWebhook)({
|
|
534
|
+
url: params.webhook.url,
|
|
535
|
+
secret: (_b = params.webhook.secret) !== null && _b !== void 0 ? _b : null,
|
|
536
|
+
payload: {
|
|
537
|
+
type: 'error',
|
|
538
|
+
renderId: params.renderId,
|
|
539
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
540
|
+
bucketName: params.bucketName,
|
|
541
|
+
errors: [err].map((e) => ({
|
|
542
|
+
message: e.message,
|
|
543
|
+
name: e.name,
|
|
544
|
+
stack: e.stack,
|
|
545
|
+
})),
|
|
546
|
+
},
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
catch (error) {
|
|
550
|
+
if (process.env.NODE_ENV === 'test') {
|
|
551
|
+
throw error;
|
|
552
|
+
}
|
|
553
|
+
await (0, write_lambda_error_1.writeLambdaError)({
|
|
554
|
+
bucketName: params.bucketName,
|
|
555
|
+
errorInfo: {
|
|
556
|
+
type: 'webhook',
|
|
557
|
+
message: err.message,
|
|
558
|
+
name: err.name,
|
|
559
|
+
stack: err.stack,
|
|
560
|
+
tmpDir: null,
|
|
561
|
+
frame: 0,
|
|
562
|
+
chunk: 0,
|
|
563
|
+
isFatal: false,
|
|
564
|
+
attempt: 1,
|
|
565
|
+
willRetry: false,
|
|
566
|
+
totalAttempts: 1,
|
|
567
|
+
},
|
|
568
|
+
renderId: params.renderId,
|
|
569
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
570
|
+
});
|
|
571
|
+
console.log('Failed to invoke webhook:');
|
|
572
|
+
console.log(error);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
411
575
|
}
|
|
412
576
|
};
|
|
413
577
|
exports.launchHandler = launchHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LambdaPayload, RenderProgress } from '../shared/constants';
|
|
2
2
|
declare type Options = {
|
|
3
3
|
expectedBucketOwner: string;
|
|
4
|
-
|
|
4
|
+
timeoutInMilliseconds: number;
|
|
5
5
|
};
|
|
6
6
|
export declare const progressHandler: (lambdaParams: LambdaPayload, options: Options) => Promise<RenderProgress>;
|
|
7
7
|
export {};
|
|
@@ -6,14 +6,15 @@ const constants_1 = require("../shared/constants");
|
|
|
6
6
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
7
7
|
const get_progress_1 = require("./helpers/get-progress");
|
|
8
8
|
const progressHandler = (lambdaParams, options) => {
|
|
9
|
+
var _a;
|
|
9
10
|
if (lambdaParams.type !== constants_1.LambdaRoutines.status) {
|
|
10
11
|
throw new TypeError('Expected status type');
|
|
11
12
|
}
|
|
12
13
|
if (lambdaParams.version !== version_1.VERSION) {
|
|
13
14
|
if (!lambdaParams.version) {
|
|
14
|
-
throw new Error(`Version mismatch: When calling
|
|
15
|
+
throw new Error(`Version mismatch: When calling renderStillOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
15
16
|
}
|
|
16
|
-
throw new Error(`Version mismatch: When calling
|
|
17
|
+
throw new Error(`Version mismatch: When calling renderStillOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
17
18
|
}
|
|
18
19
|
return (0, get_progress_1.getProgress)({
|
|
19
20
|
bucketName: lambdaParams.bucketName,
|
|
@@ -21,7 +22,8 @@ const progressHandler = (lambdaParams, options) => {
|
|
|
21
22
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
22
23
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
23
24
|
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
24
|
-
|
|
25
|
+
timeoutInMilliseconds: options.timeoutInMilliseconds,
|
|
26
|
+
customCredentials: (_a = lambdaParams.s3OutputProvider) !== null && _a !== void 0 ? _a : null,
|
|
25
27
|
});
|
|
26
28
|
};
|
|
27
29
|
exports.progressHandler = progressHandler;
|
|
File without changes
|
|
@@ -10,6 +10,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
12
12
|
const constants_1 = require("../shared/constants");
|
|
13
|
+
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
13
14
|
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
14
15
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
15
16
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
@@ -22,6 +23,12 @@ const renderHandler = async (params, options, logs) => {
|
|
|
22
23
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
23
24
|
throw new Error('Params must be renderer');
|
|
24
25
|
}
|
|
26
|
+
const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
|
|
27
|
+
bucketName: params.bucketName,
|
|
28
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
29
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
30
|
+
serialized: params.inputProps,
|
|
31
|
+
});
|
|
25
32
|
const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'), (_a = params.chromiumOptions) !== null && _a !== void 0 ? _a : {});
|
|
26
33
|
const outputPath = renderer_1.RenderInternals.tmpDir('remotion-render-');
|
|
27
34
|
if (typeof params.chunk !== 'number') {
|
|
@@ -42,6 +49,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
42
49
|
const chunkCodec = params.codec === 'gif' ? 'h264-mkv' : params.codec;
|
|
43
50
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
44
51
|
const downloads = {};
|
|
52
|
+
const inputProps = await inputPropsPromise;
|
|
45
53
|
await new Promise((resolve, reject) => {
|
|
46
54
|
var _a;
|
|
47
55
|
(0, renderer_1.renderMedia)({
|
|
@@ -53,7 +61,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
53
61
|
width: params.width,
|
|
54
62
|
},
|
|
55
63
|
imageFormat: params.imageFormat,
|
|
56
|
-
inputProps
|
|
64
|
+
inputProps,
|
|
57
65
|
frameRange: params.frameRange,
|
|
58
66
|
onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
|
|
59
67
|
if (renderedFrames % 10 === 0 &&
|
|
@@ -87,6 +95,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
87
95
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
88
96
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
89
97
|
downloadBehavior: null,
|
|
98
|
+
customCredentials: null,
|
|
90
99
|
}).catch((err) => reject(err));
|
|
91
100
|
},
|
|
92
101
|
puppeteerInstance: browserInstance,
|
|
@@ -101,7 +110,6 @@ const renderHandler = async (params, options, logs) => {
|
|
|
101
110
|
outputLocation,
|
|
102
111
|
codec: chunkCodec,
|
|
103
112
|
crf: (_a = params.crf) !== null && _a !== void 0 ? _a : undefined,
|
|
104
|
-
ffmpegExecutable: process.env.NODE_ENV === 'test' ? null : '/opt/bin/ffmpeg',
|
|
105
113
|
pixelFormat: params.pixelFormat,
|
|
106
114
|
proResProfile: params.proResProfile,
|
|
107
115
|
onDownload: (src) => {
|
|
@@ -135,6 +143,15 @@ const renderHandler = async (params, options, logs) => {
|
|
|
135
143
|
downloadMap,
|
|
136
144
|
muted: params.muted,
|
|
137
145
|
enforceAudioTrack: true,
|
|
146
|
+
audioBitrate: params.audioBitrate,
|
|
147
|
+
videoBitrate: params.videoBitrate,
|
|
148
|
+
onSlowestFrames: (slowestFrames) => {
|
|
149
|
+
console.log();
|
|
150
|
+
console.log(`Slowest frames:`);
|
|
151
|
+
slowestFrames.forEach(({ frame, time }) => {
|
|
152
|
+
console.log(`Frame ${frame} (${time.toFixed(3)}ms)`);
|
|
153
|
+
});
|
|
154
|
+
},
|
|
138
155
|
})
|
|
139
156
|
.then(() => resolve())
|
|
140
157
|
.catch((err) => reject(err));
|
|
@@ -155,6 +172,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
155
172
|
privacy: params.privacy,
|
|
156
173
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
157
174
|
downloadBehavior: null,
|
|
175
|
+
customCredentials: null,
|
|
158
176
|
});
|
|
159
177
|
await Promise.all([
|
|
160
178
|
fs_1.default.promises.rm(outputLocation, { recursive: true }),
|
|
@@ -172,6 +190,7 @@ const renderHandler = async (params, options, logs) => {
|
|
|
172
190
|
privacy: 'private',
|
|
173
191
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
174
192
|
downloadBehavior: null,
|
|
193
|
+
customCredentials: null,
|
|
175
194
|
}),
|
|
176
195
|
]);
|
|
177
196
|
};
|
|
@@ -184,6 +203,10 @@ const rendererHandler = async (params, options) => {
|
|
|
184
203
|
await renderHandler(params, options, logs);
|
|
185
204
|
}
|
|
186
205
|
catch (err) {
|
|
206
|
+
if (process.env.NODE_ENV === 'test') {
|
|
207
|
+
console.log({ err });
|
|
208
|
+
throw err;
|
|
209
|
+
}
|
|
187
210
|
// If this error is encountered, we can just retry as it
|
|
188
211
|
// is a very rare error to occur
|
|
189
212
|
const isBrowserError = err.message.includes('FATAL:zygote_communication_linux.cc') ||
|
|
File without changes
|
package/dist/functions/start.js
CHANGED
|
@@ -16,9 +16,9 @@ const startHandler = async (params, options) => {
|
|
|
16
16
|
}
|
|
17
17
|
if (params.version !== version_1.VERSION) {
|
|
18
18
|
if (!params.version) {
|
|
19
|
-
throw new Error(`Version mismatch: When calling renderMediaOnLambda(),
|
|
19
|
+
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
20
20
|
}
|
|
21
|
-
throw new Error(`Version mismatch: When calling renderMediaOnLambda(),
|
|
21
|
+
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${params.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
22
22
|
}
|
|
23
23
|
const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
24
24
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
@@ -32,6 +32,7 @@ const startHandler = async (params, options) => {
|
|
|
32
32
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
33
33
|
key: (0, constants_1.initalizedMetadataKey)(renderId),
|
|
34
34
|
privacy: 'private',
|
|
35
|
+
customCredentials: null,
|
|
35
36
|
});
|
|
36
37
|
const payload = {
|
|
37
38
|
type: constants_1.LambdaRoutines.launch,
|
|
@@ -61,6 +62,12 @@ const startHandler = async (params, options) => {
|
|
|
61
62
|
concurrencyPerLambda: params.concurrencyPerLambda,
|
|
62
63
|
downloadBehavior: params.downloadBehavior,
|
|
63
64
|
muted: params.muted,
|
|
65
|
+
overwrite: params.overwrite,
|
|
66
|
+
webhook: params.webhook,
|
|
67
|
+
audioBitrate: params.audioBitrate,
|
|
68
|
+
videoBitrate: params.videoBitrate,
|
|
69
|
+
forceHeight: params.forceHeight,
|
|
70
|
+
forceWidth: params.forceWidth,
|
|
64
71
|
};
|
|
65
72
|
await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
66
73
|
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
File without changes
|