@remotion/lambda 4.0.244 → 4.0.246

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.
Files changed (258) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/admin/make-layer-public.js +10 -11
  3. package/dist/api/app-router-webhook.d.ts +10 -0
  4. package/dist/api/app-router-webhook.js +43 -0
  5. package/dist/api/create-function.d.ts +1 -2
  6. package/dist/api/create-function.js +10 -10
  7. package/dist/api/delete-function.d.ts +4 -13
  8. package/dist/api/delete-function.js +2 -5
  9. package/dist/api/delete-render.d.ts +0 -8
  10. package/dist/api/delete-render.js +4 -10
  11. package/dist/api/delete-site.d.ts +0 -10
  12. package/dist/api/delete-site.js +4 -11
  13. package/dist/api/deploy-function.d.ts +8 -15
  14. package/dist/api/deploy-function.js +21 -27
  15. package/dist/api/deploy-site.d.ts +2 -11
  16. package/dist/api/deploy-site.js +14 -22
  17. package/dist/api/download-media.d.ts +0 -11
  18. package/dist/api/download-media.js +3 -12
  19. package/dist/api/estimate-price.d.ts +0 -6
  20. package/dist/api/estimate-price.js +1 -3
  21. package/dist/api/get-aws-client.d.ts +1 -9
  22. package/dist/api/get-aws-client.js +2 -6
  23. package/dist/api/get-compositions-on-lambda.d.ts +1 -14
  24. package/dist/api/get-compositions-on-lambda.js +12 -17
  25. package/dist/api/get-function-info.d.ts +1 -14
  26. package/dist/api/get-function-info.js +2 -5
  27. package/dist/api/get-functions.d.ts +1 -8
  28. package/dist/api/get-functions.js +2 -5
  29. package/dist/api/get-or-create-bucket.d.ts +0 -6
  30. package/dist/api/get-or-create-bucket.js +3 -5
  31. package/dist/api/get-regions.d.ts +0 -5
  32. package/dist/api/get-regions.js +3 -4
  33. package/dist/api/get-render-progress.d.ts +0 -10
  34. package/dist/api/get-render-progress.js +3 -11
  35. package/dist/api/get-sites.d.ts +0 -6
  36. package/dist/api/get-sites.js +4 -7
  37. package/dist/api/iam-validation/simulate.d.ts +0 -7
  38. package/dist/api/iam-validation/simulate.js +2 -5
  39. package/dist/api/iam-validation/suggested-policy.d.ts +0 -10
  40. package/dist/api/iam-validation/suggested-policy.js +2 -4
  41. package/dist/api/make-lambda-payload.d.ts +2 -1
  42. package/dist/api/make-lambda-payload.js +19 -13
  43. package/dist/api/pages-router-webhook.d.ts +3 -0
  44. package/dist/api/pages-router-webhook.js +47 -0
  45. package/dist/api/presign-url.d.ts +0 -10
  46. package/dist/api/presign-url.js +2 -8
  47. package/dist/api/render-media-on-lambda.d.ts +1 -20
  48. package/dist/api/render-media-on-lambda.js +4 -19
  49. package/dist/api/render-still-on-lambda.d.ts +2 -19
  50. package/dist/api/render-still-on-lambda.js +6 -17
  51. package/dist/api/speculate-function-name.d.ts +0 -8
  52. package/dist/api/speculate-function-name.js +3 -7
  53. package/dist/api/upload-dir.d.ts +1 -7
  54. package/dist/api/upload-dir.js +1 -5
  55. package/dist/api/validate-webhook-signature.d.ts +0 -8
  56. package/dist/api/validate-webhook-signature.js +3 -7
  57. package/dist/cli/args.d.ts +2 -1
  58. package/dist/cli/commands/compositions/index.d.ts +7 -1
  59. package/dist/cli/commands/compositions/index.js +2 -2
  60. package/dist/cli/commands/functions/deploy.d.ts +7 -1
  61. package/dist/cli/commands/functions/deploy.js +7 -2
  62. package/dist/cli/commands/functions/index.d.ts +8 -1
  63. package/dist/cli/commands/functions/index.js +8 -4
  64. package/dist/cli/commands/functions/ls.d.ts +6 -1
  65. package/dist/cli/commands/functions/ls.js +2 -3
  66. package/dist/cli/commands/functions/rmall.d.ts +6 -1
  67. package/dist/cli/commands/functions/rmall.js +2 -3
  68. package/dist/cli/commands/render/render.d.ts +6 -1
  69. package/dist/cli/commands/render/render.js +9 -7
  70. package/dist/cli/commands/sites/create.js +2 -0
  71. package/dist/cli/commands/sites/index.d.ts +1 -1
  72. package/dist/cli/commands/sites/index.js +4 -4
  73. package/dist/cli/commands/still.d.ts +2 -2
  74. package/dist/cli/commands/still.js +5 -5
  75. package/dist/cli/get-aws-region.js +0 -4
  76. package/dist/cli/helpers/find-function-name.d.ts +6 -1
  77. package/dist/cli/helpers/find-function-name.js +4 -5
  78. package/dist/cli/index.d.ts +2 -2
  79. package/dist/cli/index.js +36 -16
  80. package/dist/client.d.ts +17 -22
  81. package/dist/client.js +17 -13
  82. package/dist/functions/aws-implementation.d.ts +13 -1
  83. package/dist/functions/aws-implementation.js +46 -0
  84. package/dist/functions/aws-server-implementation.d.ts +2 -0
  85. package/dist/functions/aws-server-implementation.js +25 -0
  86. package/dist/functions/full-client-implementation.d.ts +3 -0
  87. package/dist/functions/full-client-implementation.js +16 -0
  88. package/dist/functions/helpers/clean-tmpdir.js +1 -3
  89. package/dist/functions/helpers/get-current-region.js +0 -4
  90. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +3 -7
  91. package/dist/functions/helpers/get-output-url-from-metadata.js +1 -1
  92. package/dist/functions/helpers/lifecycle.d.ts +4 -2
  93. package/dist/functions/helpers/lifecycle.js +3 -18
  94. package/dist/functions/helpers/timer.d.ts +2 -4
  95. package/dist/functions/http-client.d.ts +7 -0
  96. package/dist/functions/http-client.js +22 -0
  97. package/dist/functions/index.d.ts +1 -8
  98. package/dist/functions/index.js +12 -235
  99. package/dist/index.d.ts +6 -6
  100. package/dist/index.js +27 -6
  101. package/dist/internals.d.ts +6 -5
  102. package/dist/pricing/price-per-1-s.js +102 -0
  103. package/dist/regions.d.ts +1 -1
  104. package/dist/regions.js +3 -0
  105. package/dist/shared/call-lambda-async.d.ts +3 -0
  106. package/dist/shared/call-lambda-async.js +20 -0
  107. package/dist/shared/call-lambda-streaming.d.ts +7 -0
  108. package/dist/shared/{call-lambda.js → call-lambda-streaming.js} +36 -61
  109. package/dist/shared/call-lambda-sync.d.ts +3 -0
  110. package/dist/shared/call-lambda-sync.js +30 -0
  111. package/dist/shared/check-credentials.js +2 -3
  112. package/dist/shared/constants.d.ts +2 -91
  113. package/dist/shared/constants.js +1 -8
  114. package/dist/shared/convert-to-serve-url.js +2 -2
  115. package/dist/shared/get-account-id.d.ts +3 -4
  116. package/dist/shared/get-account-id.js +3 -3
  117. package/dist/shared/get-aws-urls.d.ts +4 -8
  118. package/dist/shared/get-aws-urls.js +1 -1
  119. package/dist/shared/get-function-version.js +4 -4
  120. package/dist/shared/get-layers.d.ts +1 -2
  121. package/dist/shared/get-layers.js +2 -4
  122. package/dist/shared/get-s3-operations.d.ts +4 -1
  123. package/dist/shared/get-s3-operations.js +2 -3
  124. package/dist/shared/get-service-client.js +2 -2
  125. package/dist/shared/hosted-layers.d.ts +0 -1
  126. package/dist/shared/hosted-layers.js +139 -537
  127. package/dist/shared/lambda-insights-extensions.d.ts +1 -1
  128. package/dist/shared/lambda-insights-extensions.js +3 -0
  129. package/dist/shared/read-dir.d.ts +2 -10
  130. package/dist/shared/read-dir.js +5 -4
  131. package/dist/shared/validate-aws-region.js +1 -1
  132. package/dist/shared/validate-bucketname.d.ts +1 -1
  133. package/package.json +15 -15
  134. package/remotionlambda-arm64.zip +0 -0
  135. package/dist/api/__mocks__/clean-items.d.ts +0 -2
  136. package/dist/api/__mocks__/clean-items.js +0 -24
  137. package/dist/api/__mocks__/create-function.d.ts +0 -2
  138. package/dist/api/__mocks__/create-function.js +0 -21
  139. package/dist/api/__mocks__/delete-function.d.ts +0 -2
  140. package/dist/api/__mocks__/delete-function.js +0 -9
  141. package/dist/api/__mocks__/get-functions.d.ts +0 -2
  142. package/dist/api/__mocks__/get-functions.js +0 -9
  143. package/dist/api/__mocks__/upload-dir.d.ts +0 -3
  144. package/dist/api/__mocks__/upload-dir.js +0 -47
  145. package/dist/api/mock-functions.d.ts +0 -18
  146. package/dist/api/mock-functions.js +0 -36
  147. package/dist/cli/helpers/__mocks__/quit.d.ts +0 -1
  148. package/dist/cli/helpers/__mocks__/quit.js +0 -7
  149. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +0 -7
  150. package/dist/functions/chunk-optimization/plan-frame-ranges.js +0 -17
  151. package/dist/functions/chunk-optimization/types.d.ts +0 -8
  152. package/dist/functions/chunk-optimization/types.js +0 -2
  153. package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +0 -3
  154. package/dist/functions/helpers/__mocks__/get-browser-instance.js +0 -12
  155. package/dist/functions/helpers/__mocks__/leak-detection.d.ts +0 -4
  156. package/dist/functions/helpers/__mocks__/leak-detection.js +0 -9
  157. package/dist/functions/helpers/__mocks__/timer.d.ts +0 -2
  158. package/dist/functions/helpers/__mocks__/timer.js +0 -10
  159. package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +0 -1
  160. package/dist/functions/helpers/best-frames-per-lambda-param.js +0 -17
  161. package/dist/functions/helpers/calculate-chunk-times.d.ts +0 -5
  162. package/dist/functions/helpers/calculate-chunk-times.js +0 -29
  163. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +0 -15
  164. package/dist/functions/helpers/calculate-price-from-bucket.js +0 -30
  165. package/dist/functions/helpers/can-concat-seamlessly.d.ts +0 -3
  166. package/dist/functions/helpers/can-concat-seamlessly.js +0 -17
  167. package/dist/functions/helpers/cleanup-props.d.ts +0 -8
  168. package/dist/functions/helpers/cleanup-props.js +0 -23
  169. package/dist/functions/helpers/concat-videos.d.ts +0 -23
  170. package/dist/functions/helpers/concat-videos.js +0 -54
  171. package/dist/functions/helpers/create-post-render-data.d.ts +0 -17
  172. package/dist/functions/helpers/create-post-render-data.js +0 -67
  173. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +0 -14
  174. package/dist/functions/helpers/find-output-file-in-bucket.js +0 -38
  175. package/dist/functions/helpers/format-costs-info.d.ts +0 -2
  176. package/dist/functions/helpers/format-costs-info.js +0 -23
  177. package/dist/functions/helpers/get-overall-progress-s3.d.ts +0 -10
  178. package/dist/functions/helpers/get-overall-progress-s3.js +0 -24
  179. package/dist/functions/helpers/get-overall-progress.d.ts +0 -9
  180. package/dist/functions/helpers/get-overall-progress.js +0 -23
  181. package/dist/functions/helpers/get-progress.d.ts +0 -15
  182. package/dist/functions/helpers/get-progress.js +0 -254
  183. package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
  184. package/dist/functions/helpers/get-retry-stats.js +0 -2
  185. package/dist/functions/helpers/inspect-errors.d.ts +0 -4
  186. package/dist/functions/helpers/inspect-errors.js +0 -39
  187. package/dist/functions/helpers/is-warm.d.ts +0 -2
  188. package/dist/functions/helpers/is-warm.js +0 -10
  189. package/dist/functions/helpers/leak-detection.d.ts +0 -4
  190. package/dist/functions/helpers/leak-detection.js +0 -40
  191. package/dist/functions/helpers/make-timeout-error.d.ts +0 -10
  192. package/dist/functions/helpers/make-timeout-error.js +0 -31
  193. package/dist/functions/helpers/make-timeout-message.d.ts +0 -10
  194. package/dist/functions/helpers/make-timeout-message.js +0 -75
  195. package/dist/functions/helpers/merge-chunks.d.ts +0 -36
  196. package/dist/functions/helpers/merge-chunks.js +0 -84
  197. package/dist/functions/helpers/min-max.d.ts +0 -2
  198. package/dist/functions/helpers/min-max.js +0 -33
  199. package/dist/functions/helpers/on-downloads-logger.d.ts +0 -2
  200. package/dist/functions/helpers/on-downloads-logger.js +0 -29
  201. package/dist/functions/helpers/overall-render-progress.d.ts +0 -59
  202. package/dist/functions/helpers/overall-render-progress.js +0 -180
  203. package/dist/functions/helpers/print-concurrency-curve.d.ts +0 -1
  204. package/dist/functions/helpers/print-concurrency-curve.js +0 -8
  205. package/dist/functions/helpers/print-logging-helper.d.ts +0 -4
  206. package/dist/functions/helpers/print-logging-helper.js +0 -12
  207. package/dist/functions/helpers/render-has-audio-video.d.ts +0 -6
  208. package/dist/functions/helpers/render-has-audio-video.js +0 -21
  209. package/dist/functions/helpers/request-context.d.ts +0 -5
  210. package/dist/functions/helpers/request-context.js +0 -2
  211. package/dist/functions/helpers/stream-renderer.d.ts +0 -17
  212. package/dist/functions/helpers/stream-renderer.js +0 -148
  213. package/dist/functions/launch.d.ts +0 -10
  214. package/dist/functions/launch.js +0 -596
  215. package/dist/functions/progress.d.ts +0 -11
  216. package/dist/functions/progress.js +0 -51
  217. package/dist/functions/renderer.d.ts +0 -17
  218. package/dist/functions/renderer.js +0 -341
  219. package/dist/functions/start.d.ts +0 -13
  220. package/dist/functions/start.js +0 -113
  221. package/dist/functions/still.d.ts +0 -19
  222. package/dist/functions/still.js +0 -330
  223. package/dist/shared/__mocks__/aws-clients.d.ts +0 -2
  224. package/dist/shared/__mocks__/aws-clients.js +0 -62
  225. package/dist/shared/__mocks__/bundle-site.d.ts +0 -2
  226. package/dist/shared/__mocks__/bundle-site.js +0 -32
  227. package/dist/shared/__mocks__/check-credentials.d.ts +0 -1
  228. package/dist/shared/__mocks__/check-credentials.js +0 -5
  229. package/dist/shared/__mocks__/get-account-id.d.ts +0 -2
  230. package/dist/shared/__mocks__/get-account-id.js +0 -11
  231. package/dist/shared/__mocks__/read-dir.d.ts +0 -2
  232. package/dist/shared/__mocks__/read-dir.js +0 -13
  233. package/dist/shared/call-lambda.d.ts +0 -16
  234. package/dist/shared/cleanup-serialized-input-props.d.ts +0 -14
  235. package/dist/shared/cleanup-serialized-input-props.js +0 -34
  236. package/dist/shared/docs-url.d.ts +0 -1
  237. package/dist/shared/docs-url.js +0 -4
  238. package/dist/shared/get-most-expensive-chunks.d.ts +0 -8
  239. package/dist/shared/get-most-expensive-chunks.js +0 -28
  240. package/dist/shared/invoke-webhook.d.ts +0 -48
  241. package/dist/shared/invoke-webhook.js +0 -140
  242. package/dist/shared/parse-lambda-timings-key.d.ts +0 -5
  243. package/dist/shared/parse-lambda-timings-key.js +0 -2
  244. package/dist/shared/return-values.d.ts +0 -16
  245. package/dist/shared/return-values.js +0 -2
  246. package/dist/shared/stackback.d.ts +0 -6
  247. package/dist/shared/stackback.js +0 -59
  248. package/dist/shared/validate-download-behavior.d.ts +0 -1
  249. package/dist/shared/validate-download-behavior.js +0 -21
  250. package/dist/shared/validate-frames-per-lambda.d.ts +0 -4
  251. package/dist/shared/validate-frames-per-lambda.js +0 -29
  252. package/dist/shared/validate-privacy.d.ts +0 -2
  253. package/dist/shared/validate-privacy.js +0 -14
  254. package/dist/shared/validate.d.ts +0 -4
  255. package/dist/shared/validate.js +0 -8
  256. package/dist/shared/why-is-node-running.d.ts +0 -15
  257. package/dist/shared/why-is-node-running.js +0 -88
  258. package/vitest.config.mts +0 -11
@@ -1,330 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.stillHandler = void 0;
7
- const renderer_1 = require("@remotion/renderer");
8
- const serverless_1 = require("@remotion/serverless");
9
- const client_1 = require("@remotion/serverless/client");
10
- const node_fs_1 = __importDefault(require("node:fs"));
11
- const node_path_1 = __importDefault(require("node:path"));
12
- const no_react_1 = require("remotion/no-react");
13
- const version_1 = require("remotion/version");
14
- const estimate_price_1 = require("../api/estimate-price");
15
- const defaults_1 = require("../defaults");
16
- const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
17
- const is_flaky_error_1 = require("../shared/is-flaky-error");
18
- const validate_download_behavior_1 = require("../shared/validate-download-behavior");
19
- const validate_privacy_1 = require("../shared/validate-privacy");
20
- const format_costs_info_1 = require("./helpers/format-costs-info");
21
- const get_output_url_from_metadata_1 = require("./helpers/get-output-url-from-metadata");
22
- const on_downloads_logger_1 = require("./helpers/on-downloads-logger");
23
- const overall_render_progress_1 = require("./helpers/overall-render-progress");
24
- const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, renderId, onStream, timeoutInMilliseconds, providerSpecifics, }, cleanup) => {
25
- var _a, _b, _c, _d, _e, _f, _g;
26
- if (lambdaParams.type !== client_1.ServerlessRoutines.still) {
27
- throw new TypeError('Expected still type');
28
- }
29
- if (lambdaParams.version !== version_1.VERSION) {
30
- if (!lambdaParams.version) {
31
- 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`);
32
- }
33
- 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`);
34
- }
35
- (0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
36
- (0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy, true);
37
- (0, serverless_1.validateOutname)({
38
- outName: lambdaParams.outName,
39
- codec: null,
40
- audioCodecSetting: null,
41
- separateAudioTo: null,
42
- });
43
- const start = Date.now();
44
- const browserInstancePromise = (0, serverless_1.getBrowserInstance)({
45
- logLevel: lambdaParams.logLevel,
46
- indent: false,
47
- chromiumOptions: lambdaParams.chromiumOptions,
48
- providerSpecifics,
49
- });
50
- const bucketNamePromise = (_a = lambdaParams.bucketName) !== null && _a !== void 0 ? _a : (0, client_1.internalGetOrCreateBucket)({
51
- region: providerSpecifics.getCurrentRegionInFunction(),
52
- enableFolderExpiry: null,
53
- customCredentials: null,
54
- providerSpecifics,
55
- forcePathStyle: lambdaParams.forcePathStyle,
56
- skipPutAcl: false,
57
- }).then((b) => b.bucketName);
58
- const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
59
- const outputPath = node_path_1.default.join(outputDir, 'output');
60
- const region = providerSpecifics.getCurrentRegionInFunction();
61
- const bucketName = await bucketNamePromise;
62
- const serializedInputPropsWithCustomSchema = await (0, client_1.decompressInputProps)({
63
- bucketName,
64
- expectedBucketOwner,
65
- region,
66
- serialized: lambdaParams.inputProps,
67
- propsType: 'input-props',
68
- providerSpecifics,
69
- forcePathStyle: lambdaParams.forcePathStyle,
70
- });
71
- const serveUrl = providerSpecifics.convertToServeUrl({
72
- urlOrId: lambdaParams.serveUrl,
73
- region,
74
- bucketName,
75
- });
76
- const { server, cleanupServer } = await renderer_1.RenderInternals.makeOrReuseServer(undefined, {
77
- concurrency: 1,
78
- indent: false,
79
- port: null,
80
- remotionRoot: process.cwd(),
81
- logLevel: lambdaParams.logLevel,
82
- webpackConfigOrServeUrl: serveUrl,
83
- offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
84
- binariesDirectory: null,
85
- forceIPv4: false,
86
- }, {
87
- onDownload: () => undefined,
88
- });
89
- cleanup.push(() => cleanupServer(true));
90
- const browserInstance = await browserInstancePromise;
91
- const composition = await (0, serverless_1.validateComposition)({
92
- serveUrl,
93
- browserInstance: browserInstance.instance,
94
- composition: lambdaParams.composition,
95
- serializedInputPropsWithCustomSchema,
96
- envVariables: (_b = lambdaParams.envVariables) !== null && _b !== void 0 ? _b : {},
97
- chromiumOptions: lambdaParams.chromiumOptions,
98
- timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
99
- port: null,
100
- forceHeight: lambdaParams.forceHeight,
101
- forceWidth: lambdaParams.forceWidth,
102
- logLevel: lambdaParams.logLevel,
103
- server,
104
- offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
105
- onBrowserDownload: () => {
106
- throw new Error('Should not download a browser in Lambda');
107
- },
108
- onServeUrlVisited: () => undefined,
109
- providerSpecifics,
110
- });
111
- const renderMetadata = {
112
- startedDate: Date.now(),
113
- codec: null,
114
- compositionId: lambdaParams.composition,
115
- estimatedTotalLambdaInvokations: 1,
116
- estimatedRenderLambdaInvokations: 1,
117
- siteId: serveUrl,
118
- totalChunks: 1,
119
- type: 'still',
120
- imageFormat: lambdaParams.imageFormat,
121
- inputProps: lambdaParams.inputProps,
122
- lambdaVersion: version_1.VERSION,
123
- framesPerLambda: 1,
124
- memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
125
- region: providerSpecifics.getCurrentRegionInFunction(),
126
- renderId,
127
- outName: (_c = lambdaParams.outName) !== null && _c !== void 0 ? _c : undefined,
128
- privacy: lambdaParams.privacy,
129
- audioCodec: null,
130
- deleteAfter: lambdaParams.deleteAfter,
131
- numberOfGifLoops: null,
132
- downloadBehavior: lambdaParams.downloadBehavior,
133
- audioBitrate: null,
134
- metadata: null,
135
- functionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
136
- dimensions: {
137
- height: composition.height * ((_d = lambdaParams.scale) !== null && _d !== void 0 ? _d : 1),
138
- width: composition.width * ((_e = lambdaParams.scale) !== null && _e !== void 0 ? _e : 1),
139
- },
140
- };
141
- const still = (0, overall_render_progress_1.makeInitialOverallRenderProgress)(timeoutInMilliseconds);
142
- still.renderMetadata = renderMetadata;
143
- await providerSpecifics.writeFile({
144
- bucketName,
145
- key: (0, client_1.overallProgressKey)(renderId),
146
- body: JSON.stringify(still),
147
- region: providerSpecifics.getCurrentRegionInFunction(),
148
- privacy: 'private',
149
- expectedBucketOwner,
150
- downloadBehavior: null,
151
- customCredentials: null,
152
- forcePathStyle: lambdaParams.forcePathStyle,
153
- });
154
- const onBrowserDownload = () => {
155
- throw new Error('Should not download a browser in Lambda');
156
- };
157
- const receivedArtifact = [];
158
- const { key, renderBucketName, customCredentials } = (0, client_1.getExpectedOutName)(renderMetadata, bucketName, (0, serverless_1.getCredentialsFromOutName)(lambdaParams.outName));
159
- const onArtifact = (artifact) => {
160
- if (receivedArtifact.find((a) => a.filename === artifact.filename)) {
161
- return { alreadyExisted: true };
162
- }
163
- const storageKey = (0, client_1.artifactName)(renderMetadata.renderId, artifact.filename);
164
- receivedArtifact.push(providerSpecifics.makeArtifactWithDetails({
165
- storageKey,
166
- artifact,
167
- region,
168
- renderBucketName,
169
- }));
170
- const startTime = Date.now();
171
- renderer_1.RenderInternals.Log.info({ indent: false, logLevel: lambdaParams.logLevel }, 'Writing artifact ' + artifact.filename + ' to S3');
172
- providerSpecifics
173
- .writeFile({
174
- bucketName: renderBucketName,
175
- key: storageKey,
176
- body: artifact.content,
177
- region,
178
- privacy: lambdaParams.privacy,
179
- expectedBucketOwner,
180
- downloadBehavior: lambdaParams.downloadBehavior,
181
- customCredentials,
182
- forcePathStyle: lambdaParams.forcePathStyle,
183
- })
184
- .then(() => {
185
- renderer_1.RenderInternals.Log.info({ indent: false, logLevel: lambdaParams.logLevel }, `Wrote artifact to S3 in ${Date.now() - startTime}ms`);
186
- })
187
- .catch((err) => {
188
- renderer_1.RenderInternals.Log.error({ indent: false, logLevel: lambdaParams.logLevel }, 'Failed to write artifact to S3', err);
189
- });
190
- return { alreadyExisted: false };
191
- };
192
- await renderer_1.RenderInternals.internalRenderStill({
193
- composition,
194
- output: outputPath,
195
- serveUrl,
196
- envVariables: (_f = lambdaParams.envVariables) !== null && _f !== void 0 ? _f : {},
197
- frame: renderer_1.RenderInternals.convertToPositiveFrameIndex({
198
- frame: lambdaParams.frame,
199
- durationInFrames: composition.durationInFrames,
200
- }),
201
- imageFormat: lambdaParams.imageFormat,
202
- serializedInputPropsWithCustomSchema,
203
- overwrite: false,
204
- puppeteerInstance: browserInstance.instance,
205
- jpegQuality: (_g = lambdaParams.jpegQuality) !== null && _g !== void 0 ? _g : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
206
- chromiumOptions: lambdaParams.chromiumOptions,
207
- scale: lambdaParams.scale,
208
- timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
209
- browserExecutable: providerSpecifics.getChromiumPath(),
210
- cancelSignal: null,
211
- indent: false,
212
- onBrowserLog: null,
213
- onDownload: (0, on_downloads_logger_1.onDownloadsHelper)(lambdaParams.logLevel),
214
- port: null,
215
- server,
216
- logLevel: lambdaParams.logLevel,
217
- serializedResolvedPropsWithCustomSchema: no_react_1.NoReactInternals.serializeJSONWithDate({
218
- indent: undefined,
219
- staticBase: null,
220
- data: composition.props,
221
- }).serializedString,
222
- offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
223
- binariesDirectory: null,
224
- onBrowserDownload,
225
- onArtifact,
226
- });
227
- const { size } = await node_fs_1.default.promises.stat(outputPath);
228
- await providerSpecifics.writeFile({
229
- bucketName: renderBucketName,
230
- key,
231
- privacy: lambdaParams.privacy,
232
- body: node_fs_1.default.createReadStream(outputPath),
233
- expectedBucketOwner,
234
- region: providerSpecifics.getCurrentRegionInFunction(),
235
- downloadBehavior: lambdaParams.downloadBehavior,
236
- customCredentials,
237
- forcePathStyle: lambdaParams.forcePathStyle,
238
- });
239
- await Promise.all([
240
- node_fs_1.default.promises.rm(outputPath, { recursive: true }),
241
- (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
242
- region: providerSpecifics.getCurrentRegionInFunction(),
243
- serialized: lambdaParams.inputProps,
244
- providerSpecifics,
245
- forcePathStyle: lambdaParams.forcePathStyle,
246
- }),
247
- server.closeServer(true),
248
- ]);
249
- const estimatedPrice = (0, estimate_price_1.estimatePrice)({
250
- durationInMilliseconds: Date.now() - start + 100,
251
- memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
252
- region: providerSpecifics.getCurrentRegionInFunction(),
253
- lambdasInvoked: 1,
254
- // We cannot determine the ephemeral storage size, so we
255
- // overestimate the price, but will only have a miniscule effect (~0.2%)
256
- diskSizeInMb: defaults_1.MAX_EPHEMERAL_STORAGE_IN_MB,
257
- });
258
- const { key: outKey, url } = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, bucketName, customCredentials, providerSpecifics.getCurrentRegionInFunction());
259
- const payload = {
260
- type: 'success',
261
- output: url,
262
- size,
263
- sizeInBytes: size,
264
- bucketName,
265
- estimatedPrice: (0, format_costs_info_1.formatCostsInfo)(estimatedPrice),
266
- renderId,
267
- outKey,
268
- receivedArtifacts: receivedArtifact,
269
- };
270
- onStream({
271
- type: 'still-rendered',
272
- payload,
273
- });
274
- await server.closeServer(true);
275
- };
276
- const stillHandler = async (options) => {
277
- const { params } = options;
278
- const cleanUpFn = [];
279
- if (params.type !== client_1.ServerlessRoutines.still) {
280
- throw new Error('Params must be renderer');
281
- }
282
- try {
283
- await innerStillHandler(options, cleanUpFn);
284
- return { type: 'success' };
285
- }
286
- catch (err) {
287
- // If this error is encountered, we can just retry as it
288
- // is a very rare error to occur
289
- const isBrowserError = (0, is_flaky_error_1.isFlakyError)(err);
290
- const willRetry = isBrowserError || params.maxRetries > 0;
291
- renderer_1.RenderInternals.Log.error({
292
- indent: false,
293
- logLevel: params.logLevel,
294
- }, 'Got error:', err.stack, `Will retry = ${willRetry}`);
295
- if (params.streamed) {
296
- await options.onStream({
297
- type: 'error-occurred',
298
- payload: {
299
- error: err.stack,
300
- shouldRetry: willRetry,
301
- errorInfo: {
302
- name: err.name,
303
- message: err.message,
304
- stack: err.stack,
305
- chunk: null,
306
- frame: params.frame,
307
- type: 'renderer',
308
- isFatal: false,
309
- tmpDir: (0, serverless_1.getTmpDirStateIfENoSp)(err.stack, options.providerSpecifics),
310
- attempt: params.attempt,
311
- totalAttempts: 1 + params.maxRetries,
312
- willRetry,
313
- },
314
- },
315
- });
316
- }
317
- return {
318
- type: 'error',
319
- message: err.message,
320
- stack: err.stack,
321
- };
322
- }
323
- finally {
324
- (0, serverless_1.forgetBrowserEventLoop)(options.params.type === client_1.ServerlessRoutines.still
325
- ? options.params.logLevel
326
- : 'error');
327
- cleanUpFn.forEach((c) => c());
328
- }
329
- };
330
- exports.stillHandler = stillHandler;
@@ -1,2 +0,0 @@
1
- import type { getLambdaClient as original } from '../../shared/aws-clients';
2
- export declare const getLambdaClient: typeof original;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getLambdaClient = void 0;
27
- const serverless_1 = require("@remotion/serverless");
28
- const mock_implementation_1 = require("../../test/mock-implementation");
29
- const getLambdaClient = (_region, timeoutInTest) => {
30
- return {
31
- config: {
32
- requestHandler: {},
33
- apiVersion: 'fake',
34
- },
35
- destroy: () => undefined,
36
- middlewareStack: undefined,
37
- send: async (params) => {
38
- const payload = JSON.parse(params.input.Payload);
39
- const { innerRoutine } = await Promise.resolve().then(() => __importStar(require('../../functions/index')));
40
- const responseStream = new serverless_1.ResponseStream();
41
- const prom = innerRoutine(payload, responseStream, {
42
- invokedFunctionArn: 'arn:fake',
43
- getRemainingTimeInMillis: () => timeoutInTest !== null && timeoutInTest !== void 0 ? timeoutInTest : 120000,
44
- awsRequestId: 'fake',
45
- }, mock_implementation_1.mockImplementation);
46
- if (params.input.InvocationType === 'RequestResponse' ||
47
- params.input.InvocationType === 'Event') {
48
- await prom;
49
- return { Payload: responseStream.getBufferedData() };
50
- }
51
- prom.then(() => {
52
- responseStream._finish();
53
- responseStream.end();
54
- });
55
- // When streaming, we should not consume the response
56
- return {
57
- EventStream: responseStream,
58
- };
59
- },
60
- };
61
- };
62
- exports.getLambdaClient = getLambdaClient;
@@ -1,2 +0,0 @@
1
- import type { bundle } from '@remotion/bundler';
2
- export declare const bundleSite: typeof bundle;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bundleSite = void 0;
4
- const convertArgumentsIntoOptions = (args) => {
5
- var _a;
6
- if (args.length === 0) {
7
- throw new TypeError('bundle() was called without arguments');
8
- }
9
- const firstArg = args[0];
10
- if (typeof firstArg === 'string') {
11
- return {
12
- entryPoint: firstArg,
13
- onProgress: args[1],
14
- ...((_a = args[2]) !== null && _a !== void 0 ? _a : {}),
15
- };
16
- }
17
- if (typeof firstArg.entryPoint !== 'string') {
18
- throw new TypeError('bundle() was called without the `entryPoint` option');
19
- }
20
- return firstArg;
21
- };
22
- const bundleSite = (...args) => {
23
- const { entryPoint } = convertArgumentsIntoOptions(args);
24
- if (entryPoint === 'first') {
25
- return Promise.resolve('/path/to/bundle-1');
26
- }
27
- if (entryPoint === 'second') {
28
- return Promise.resolve('/path/to/bundle-2');
29
- }
30
- throw new Error('unknown entry');
31
- };
32
- exports.bundleSite = bundleSite;
@@ -1 +0,0 @@
1
- export declare const checkCredentials: () => undefined;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkCredentials = void 0;
4
- const checkCredentials = () => undefined;
5
- exports.checkCredentials = checkCredentials;
@@ -1,2 +0,0 @@
1
- import type { getAccountId as original } from '../get-account-id';
2
- export declare const getAccountId: typeof original;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccountId = void 0;
4
- const getAccountId = () => {
5
- const accountId = 'aws:iam::123456789'.match(/aws:iam::([0-9]+)/);
6
- if (!accountId) {
7
- throw new Error('Cannot get account ID');
8
- }
9
- return Promise.resolve(accountId[1]);
10
- };
11
- exports.getAccountId = getAccountId;
@@ -1,2 +0,0 @@
1
- import type { readDirectory as original } from '../../shared/read-dir';
2
- export declare const readDirectory: typeof original;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readDirectory = void 0;
4
- const upload_dir_1 = require("../../api/__mocks__/upload-dir");
5
- const readDirectory = ({ dir }) => {
6
- const files = (0, upload_dir_1.getDirFiles)(dir);
7
- const obj = {};
8
- for (const file of files) {
9
- obj[file.name] = () => Promise.resolve('etag');
10
- }
11
- return obj;
12
- };
13
- exports.readDirectory = readDirectory;
@@ -1,16 +0,0 @@
1
- import type { CloudProvider, OnMessage } from '@remotion/serverless';
2
- import type { ServerlessPayloads, ServerlessRoutines } from '@remotion/serverless/client';
3
- import type { LambdaReturnValues } from './return-values';
4
- type Options<T extends ServerlessRoutines, Provider extends CloudProvider> = {
5
- functionName: string;
6
- type: T;
7
- payload: Omit<ServerlessPayloads<Provider>[T], 'type'>;
8
- region: Provider['region'];
9
- timeoutInTest: number;
10
- };
11
- export declare const callLambda: <Provider extends CloudProvider, T extends ServerlessRoutines>(options: Options<T, Provider>) => Promise<LambdaReturnValues<Provider>[T]>;
12
- export declare const callLambdaWithStreaming: <Provider extends CloudProvider, T extends ServerlessRoutines>(options: Options<T, Provider> & {
13
- receivedStreamingPayload: OnMessage<Provider>;
14
- retriesRemaining: number;
15
- }) => Promise<void>;
16
- export {};
@@ -1,14 +0,0 @@
1
- import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
2
- import { type SerializedInputProps } from '@remotion/serverless/client';
3
- export declare const cleanupSerializedInputProps: <Provider extends CloudProvider>({ serialized, region, providerSpecifics, forcePathStyle, }: {
4
- serialized: SerializedInputProps;
5
- region: Provider["region"];
6
- providerSpecifics: ProviderSpecifics<Provider>;
7
- forcePathStyle: boolean;
8
- }) => Promise<number>;
9
- export declare const cleanupSerializedResolvedProps: <Provider extends CloudProvider>({ serialized, region, providerSpecifics, forcePathStyle, }: {
10
- serialized: SerializedInputProps;
11
- region: Provider["region"];
12
- providerSpecifics: ProviderSpecifics<Provider>;
13
- forcePathStyle: boolean;
14
- }) => Promise<number>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanupSerializedResolvedProps = exports.cleanupSerializedInputProps = void 0;
4
- const client_1 = require("@remotion/serverless/client");
5
- const cleanupSerializedInputProps = async ({ serialized, region, providerSpecifics, forcePathStyle, }) => {
6
- if (serialized.type === 'payload') {
7
- return 0;
8
- }
9
- const time = Date.now();
10
- await providerSpecifics.deleteFile({
11
- bucketName: serialized.bucketName,
12
- key: (0, client_1.inputPropsKey)(serialized.hash),
13
- region,
14
- customCredentials: null,
15
- forcePathStyle,
16
- });
17
- return Date.now() - time;
18
- };
19
- exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
20
- const cleanupSerializedResolvedProps = async ({ serialized, region, providerSpecifics, forcePathStyle, }) => {
21
- if (serialized.type === 'payload') {
22
- return 0;
23
- }
24
- const time = Date.now();
25
- await providerSpecifics.deleteFile({
26
- bucketName: serialized.bucketName,
27
- key: (0, client_1.resolvedPropsKey)(serialized.hash),
28
- region,
29
- customCredentials: null,
30
- forcePathStyle,
31
- });
32
- return Date.now() - time;
33
- };
34
- exports.cleanupSerializedResolvedProps = cleanupSerializedResolvedProps;
@@ -1 +0,0 @@
1
- export declare const DOCS_URL = "https://remotion.dev";
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DOCS_URL = void 0;
4
- exports.DOCS_URL = 'https://remotion.dev';
@@ -1,8 +0,0 @@
1
- import type { ParsedTiming } from './parse-lambda-timings-key';
2
- export declare const OVERHEAD_TIME_PER_LAMBDA = 100;
3
- export type ExpensiveChunk = {
4
- chunk: number;
5
- frameRange: [number, number];
6
- timeInMilliseconds: number;
7
- };
8
- export declare const getMostExpensiveChunks: (parsedTimings: ParsedTiming[], framesPerLambda: number, firstFrame: number, lastFrame: number) => ExpensiveChunk[];
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMostExpensiveChunks = exports.OVERHEAD_TIME_PER_LAMBDA = void 0;
4
- exports.OVERHEAD_TIME_PER_LAMBDA = 100;
5
- const getMostExpensiveChunks = (parsedTimings, framesPerLambda, firstFrame, lastFrame) => {
6
- const mostExpensiveChunks = parsedTimings
7
- .slice(0)
8
- .sort((a, b) => {
9
- const durA = a.rendered - a.start;
10
- const durB = b.rendered - b.start;
11
- return durB - durA;
12
- })
13
- .slice(0, 5);
14
- return mostExpensiveChunks.map((c) => {
15
- const isLastChunk = c.chunk === parsedTimings.length - 1;
16
- return {
17
- timeInMilliseconds: c.rendered - c.start,
18
- chunk: c.chunk,
19
- frameRange: [
20
- framesPerLambda * c.chunk + firstFrame,
21
- isLastChunk
22
- ? lastFrame
23
- : framesPerLambda * (c.chunk + 1) - 1 + firstFrame,
24
- ],
25
- };
26
- });
27
- };
28
- exports.getMostExpensiveChunks = getMostExpensiveChunks;
@@ -1,48 +0,0 @@
1
- import type { LogLevel } from '@remotion/renderer';
2
- import type { EnhancedErrorInfo } from '@remotion/serverless';
3
- import https from 'https';
4
- import http from 'node:http';
5
- import type { AfterRenderCost } from './constants';
6
- /**
7
- * @description Calculates cryptographically secure signature for webhooks using Hmac.
8
- * @link https://remotion.dev/docs/lambda/webhooks#validate-webhooks
9
- * @param payload Stringified request body to encode in the signature.
10
- * @param secret User-provided webhook secret used to sign the request.
11
- * @returns {string} Calculated signature
12
- */
13
- export declare function calculateSignature(payload: string, secret: string | null): string;
14
- type DynamicWebhookPayload = {
15
- type: 'error';
16
- errors: {
17
- message: string;
18
- name: string;
19
- stack: string;
20
- }[];
21
- } | {
22
- type: 'success';
23
- lambdaErrors: EnhancedErrorInfo[];
24
- outputUrl: string | undefined;
25
- outputFile: string | undefined;
26
- timeToFinish: number | undefined;
27
- costs: AfterRenderCost;
28
- } | {
29
- type: 'timeout';
30
- };
31
- export type WebhookPayload = {
32
- renderId: string;
33
- expectedBucketOwner: string;
34
- bucketName: string;
35
- customData: Record<string, unknown> | null;
36
- } & DynamicWebhookPayload;
37
- export declare const mockableHttpClients: {
38
- http: typeof http.request;
39
- https: typeof https.request;
40
- };
41
- type InvokeWebhookOptions = {
42
- payload: WebhookPayload;
43
- url: string;
44
- secret: string | null;
45
- redirectsSoFar: number;
46
- };
47
- export declare const invokeWebhook: (options: InvokeWebhookOptions, logLevel: LogLevel, retries?: number, errors?: number) => Promise<void>;
48
- export {};