@remotion/cloudrun 4.0.44 → 4.0.46

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.
@@ -1,14 +1,14 @@
1
1
 
2
- > @remotion/cloudrun@4.0.43 build /Users/jonathanburger/remotion/packages/cloudrun
2
+ > @remotion/cloudrun@4.0.45 build /Users/jonathanburger/remotion/packages/cloudrun
3
3
  > tsc -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json && pnpm run buildContainer && pnpm run tarInstaller
4
4
 
5
5
 
6
- > @remotion/cloudrun@4.0.43 buildContainer /Users/jonathanburger/remotion/packages/cloudrun
6
+ > @remotion/cloudrun@4.0.45 buildContainer /Users/jonathanburger/remotion/packages/cloudrun
7
7
  > ts-node src/admin/bundle-renderLogic.ts
8
8
 
9
9
  distribution bundled.
10
10
 
11
- > @remotion/cloudrun@4.0.43 tarInstaller /Users/jonathanburger/remotion/packages/cloudrun
11
+ > @remotion/cloudrun@4.0.45 tarInstaller /Users/jonathanburger/remotion/packages/cloudrun
12
12
  > ts-node src/admin/bundle-installer.ts
13
13
 
14
- Making non-reproducible build with tar.
14
+ Making reproducible build with gtar
@@ -0,0 +1,27 @@
1
+
2
+ > @remotion/cloudrun@4.0.45 lint /Users/jonathanburger/remotion/packages/cloudrun
3
+ > eslint src --ext ts,tsx
4
+
5
+ Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.
6
+
7
+ /Users/jonathanburger/remotion/packages/cloudrun/src/api/check-if-service-exists.ts
8
+ 56:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
9
+
10
+ /Users/jonathanburger/remotion/packages/cloudrun/src/api/render-media-on-cloudrun.ts
11
+ 217:3 warning Unexpected 'todo' comment: 'TODO: Add any sort of type safety' no-warning-comments
12
+ 226:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
13
+
14
+ /Users/jonathanburger/remotion/packages/cloudrun/src/api/render-still-on-cloudrun.ts
15
+ 153:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
16
+
17
+ /Users/jonathanburger/remotion/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
18
+ 68:4 warning Unexpected 'todo' comment: 'TODO: Log if there is an incompatible...' no-warning-comments
19
+
20
+ /Users/jonathanburger/remotion/packages/cloudrun/src/cli/commands/render/index.ts
21
+ 118:2 warning Unexpected 'todo' comment: 'Todo: Check cloudRunUrl is valid, as the...' no-warning-comments
22
+
23
+ /Users/jonathanburger/remotion/packages/cloudrun/src/cli/commands/still.ts
24
+ 104:2 warning Unexpected 'todo' comment: 'Todo: Check cloudRunUrl is valid, as the...' no-warning-comments
25
+
26
+ ✖ 7 problems (0 errors, 7 warnings)
27
+
@@ -45,8 +45,8 @@ const bundleInstaller = async () => {
45
45
  bundleInstaller();
46
46
  const hasGTar = () => {
47
47
  try {
48
- const output = (0, child_process_1.execSync)('gtar --usage');
49
- return output.includes('Usage: --sort');
48
+ const output = (0, child_process_1.execSync)('gtar --usage', {});
49
+ return output.includes('--sort');
50
50
  }
51
51
  catch (_a) {
52
52
  return false;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deleteService = void 0;
4
+ const is_in_cloud_task_1 = require("../functions/helpers/is-in-cloud-task");
4
5
  const get_cloud_run_client_1 = require("./helpers/get-cloud-run-client");
5
6
  /**
6
7
  * @description Deletes a service from GCP Cloud Run
@@ -13,7 +14,7 @@ const deleteService = async (params) => {
13
14
  const cloudRunClient = (0, get_cloud_run_client_1.getCloudRunClient)();
14
15
  // Run request
15
16
  await cloudRunClient.deleteService({
16
- name: `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${params.region}/services/${params.serviceName}`,
17
+ name: `projects/${(0, is_in_cloud_task_1.getProjectId)()}/locations/${params.region}/services/${params.serviceName}`,
17
18
  });
18
19
  };
19
20
  exports.deleteService = deleteService;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getServiceInfo = void 0;
4
4
  const make_console_url_1 = require("../cli/helpers/make-console-url");
5
+ const is_in_cloud_task_1 = require("../functions/helpers/is-in-cloud-task");
5
6
  const get_cloud_run_client_1 = require("./helpers/get-cloud-run-client");
6
7
  const parse_service_name_1 = require("./helpers/parse-service-name");
7
8
  /**
@@ -15,7 +16,7 @@ const getServiceInfo = async ({ region, serviceName, }) => {
15
16
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16
17
  const cloudRunClient = (0, get_cloud_run_client_1.getCloudRunClient)();
17
18
  const [service] = await cloudRunClient.getService({
18
- name: `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${region}/services/${serviceName}`,
19
+ name: `projects/${(0, is_in_cloud_task_1.getProjectId)()}/locations/${region}/services/${serviceName}`,
19
20
  });
20
21
  if (!service) {
21
22
  throw new Error(`Service ${serviceName} not found`);
@@ -2,13 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAuthClientForUrl = void 0;
4
4
  const google_auth_library_1 = require("google-auth-library");
5
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
6
  const getAuthClientForUrl = async (url) => {
6
- const auth = new google_auth_library_1.GoogleAuth({
7
- credentials: {
8
- client_email: process.env.REMOTION_GCP_CLIENT_EMAIL,
9
- private_key: process.env.REMOTION_GCP_PRIVATE_KEY,
10
- },
11
- });
7
+ let auth = new google_auth_library_1.GoogleAuth();
8
+ if ((0, is_in_cloud_task_1.isInCloudTask)()) {
9
+ auth = new google_auth_library_1.GoogleAuth({
10
+ projectId: (0, is_in_cloud_task_1.getProjectId)(),
11
+ });
12
+ }
13
+ else {
14
+ auth = new google_auth_library_1.GoogleAuth({
15
+ projectId: process.env.REMOTION_GCP_PROJECT_ID,
16
+ credentials: {
17
+ client_email: process.env.REMOTION_GCP_CLIENT_EMAIL,
18
+ private_key: process.env.REMOTION_GCP_PRIVATE_KEY,
19
+ },
20
+ });
21
+ }
12
22
  const client = await auth.getIdTokenClient(url);
13
23
  return client;
14
24
  };
@@ -2,8 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCloudLoggingClient = void 0;
4
4
  const logging_1 = require("@google-cloud/logging");
5
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
6
  const { LoggingServiceV2Client } = logging_1.v2;
6
7
  const getCloudLoggingClient = () => {
8
+ if ((0, is_in_cloud_task_1.isInCloudTask)()) {
9
+ return new LoggingServiceV2Client({
10
+ projectId: (0, is_in_cloud_task_1.getProjectId)(),
11
+ });
12
+ }
7
13
  return new LoggingServiceV2Client({
8
14
  projectId: process.env.REMOTION_GCP_PROJECT_ID,
9
15
  credentials: {
@@ -2,8 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCloudRunClient = void 0;
4
4
  const run_1 = require("@google-cloud/run");
5
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
6
  const { ServicesClient } = run_1.v2;
6
7
  const getCloudRunClient = () => {
8
+ if ((0, is_in_cloud_task_1.isInCloudTask)()) {
9
+ return new ServicesClient({
10
+ projectId: (0, is_in_cloud_task_1.getProjectId)(),
11
+ });
12
+ }
7
13
  return new ServicesClient({
8
14
  projectId: process.env.REMOTION_GCP_PROJECT_ID,
9
15
  credentials: {
@@ -2,7 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCloudStorageClient = void 0;
4
4
  const storage_1 = require("@google-cloud/storage");
5
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
6
  const getCloudStorageClient = () => {
7
+ if ((0, is_in_cloud_task_1.isInCloudTask)()) {
8
+ return new storage_1.Storage({
9
+ projectId: (0, is_in_cloud_task_1.getProjectId)(),
10
+ });
11
+ }
6
12
  return new storage_1.Storage({
7
13
  projectId: process.env.REMOTION_GCP_PROJECT_ID,
8
14
  credentials: {
@@ -2,8 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getResourceManagerClient = void 0;
4
4
  const resource_manager_1 = require("@google-cloud/resource-manager");
5
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
6
  const { ProjectsClient } = resource_manager_1.v3;
6
7
  const getResourceManagerClient = () => {
8
+ if ((0, is_in_cloud_task_1.isInCloudTask)()) {
9
+ return new ProjectsClient({
10
+ projectId: (0, is_in_cloud_task_1.getProjectId)(),
11
+ });
12
+ }
7
13
  return new ProjectsClient({
8
14
  projectId: process.env.REMOTION_GCP_PROJECT_ID,
9
15
  credentials: {
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseServiceName = exports.getGcpParent = void 0;
4
4
  const make_console_url_1 = require("../../cli/helpers/make-console-url");
5
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
6
  const getGcpParent = (region) => {
6
- const parent = `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${region}`;
7
+ const parent = `projects/${(0, is_in_cloud_task_1.getProjectId)()}/locations/${region}`;
7
8
  return parent;
8
9
  };
9
10
  exports.getGcpParent = getGcpParent;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.testPermissions = exports.logPermissionOutput = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
9
10
  const get_resource_manager_client_1 = require("../helpers/get-resource-manager-client");
10
11
  const logPermissionOutput = (output) => {
11
12
  return [output.decision ? '✅' : '❌', output.permissionName].join(' ');
@@ -23,7 +24,7 @@ const testPermissions = async (params) => {
23
24
  const saPermissions = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../../shared/sa-permissions.json'), 'utf-8'));
24
25
  const permissionList = saPermissions.list.map((permission) => permission.name);
25
26
  const response = await resourceManagerClient.testIamPermissions({
26
- resource: `projects/${process.env.REMOTION_GCP_PROJECT_ID}`,
27
+ resource: `projects/${(0, is_in_cloud_task_1.getProjectId)()}`,
27
28
  permissions: permissionList,
28
29
  });
29
30
  const returnedPermissions = response[0].permissions;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
5
+ (0, vitest_1.beforeEach)(() => {
6
+ delete process.env.GCLOUD_PROJECT;
7
+ delete process.env.REMOTION_GCP_PROJECT_ID;
8
+ delete process.env.K_CONFIGURATION;
9
+ });
10
+ (0, vitest_1.test)('is running in cloud tasks = true', () => {
11
+ process.env.GCLOUD_PROJECT = 'remotion-test-cloudtask';
12
+ process.env.K_CONFIGURATION = 'config';
13
+ const isInCloud = (0, is_in_cloud_task_1.isInCloudTask)();
14
+ (0, vitest_1.expect)(isInCloud).toBe(true);
15
+ });
16
+ (0, vitest_1.test)('is running in cloud tasks = false', () => {
17
+ process.env.REMOTION_GCP_PROJECT_ID = 'remotion-test-cloudtask';
18
+ const isInCloud = (0, is_in_cloud_task_1.isInCloudTask)();
19
+ (0, vitest_1.expect)(isInCloud).toBe(false);
20
+ });
21
+ (0, vitest_1.test)('which project Id = remotion-test', () => {
22
+ process.env.REMOTION_GCP_PROJECT_ID = 'remotion-test';
23
+ const projectId = (0, is_in_cloud_task_1.getProjectId)();
24
+ (0, vitest_1.expect)(projectId).toBe('remotion-test');
25
+ });
26
+ (0, vitest_1.test)('which project Id = remotion-test-cloudtask', () => {
27
+ process.env.GCLOUD_PROJECT = 'remotion-test-cloudtask';
28
+ process.env.K_CONFIGURATION = 'config';
29
+ const projectId = (0, is_in_cloud_task_1.getProjectId)();
30
+ (0, vitest_1.expect)(projectId).toBe('remotion-test-cloudtask');
31
+ });
@@ -6,8 +6,8 @@ const parse_service_name_1 = require("../helpers/parse-service-name");
6
6
  const speculate_service_name_1 = require("../speculate-service-name");
7
7
  const dashedVersion = remotion_1.VERSION.replace(/\./g, '-');
8
8
  const region = 'asia-east1';
9
- process.env.REMOTION_GCP_PROJECT_ID = 'remotion-test-project';
10
9
  (0, vitest_1.test)('Parse service names', () => {
10
+ process.env.REMOTION_GCP_PROJECT_ID = 'remotion-test-project';
11
11
  const shortServiceName = (0, speculate_service_name_1.speculateServiceName)({
12
12
  cpuLimit: '8.0',
13
13
  memoryLimit: '100000k',
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.permissionsCommand = exports.PERMISSIONS_COMMAND = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const testPermissions_1 = require("../../api/iam-validation/testPermissions");
6
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
6
7
  const log_1 = require("../log");
7
8
  exports.PERMISSIONS_COMMAND = 'permissions';
8
9
  const permissionsCommand = async () => {
9
10
  try {
10
- log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Checking permissions for ${process.env.REMOTION_GCP_CLIENT_EMAIL} in project ${process.env.REMOTION_GCP_PROJECT_ID}.`));
11
+ log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Checking permissions for ${process.env.REMOTION_GCP_CLIENT_EMAIL} in project ${(0, is_in_cloud_task_1.getProjectId)()}.`));
11
12
  log_1.Log.info();
12
13
  await (0, testPermissions_1.testPermissions)({
13
14
  onTest: (res) => {
@@ -5,6 +5,7 @@ const cli_1 = require("@remotion/cli");
5
5
  const extract_mem_from_url_1 = require("../../api/helpers/extract-mem-from-url");
6
6
  const extract_time_from_url_1 = require("../../api/helpers/extract-time-from-url");
7
7
  const get_cloud_logging_client_1 = require("../../api/helpers/get-cloud-logging-client");
8
+ const is_in_cloud_task_1 = require("../../functions/helpers/is-in-cloud-task");
8
9
  const log_1 = require("../log");
9
10
  const displayCrashLogs = async (res) => {
10
11
  let timeoutPreMsg = '';
@@ -18,11 +19,11 @@ const displayCrashLogs = async (res) => {
18
19
  }
19
20
  log_1.Log.error(`Error rendering on Cloud Run. The Cloud Run service did not return a response.\n
20
21
  ${timeoutPreMsg}The crash may be due to the service exceeding its memory limit of ${memoryLimit}.
21
- Full logs are available at https://console.cloud.google.com/run?project=${process.env.REMOTION_GCP_PROJECT_ID}\n`);
22
+ Full logs are available at https://console.cloud.google.com/run?project=${(0, is_in_cloud_task_1.getProjectId)()}\n`);
22
23
  const cloudLoggingClient = (0, get_cloud_logging_client_1.getCloudLoggingClient)();
23
24
  const listLogEntriesRequest = {
24
- resourceNames: [`projects/${process.env.REMOTION_GCP_PROJECT_ID}`],
25
- filter: `logName=projects/${process.env.REMOTION_GCP_PROJECT_ID}/logs/run.googleapis.com%2Fvarlog%2Fsystem AND (severity=WARNING OR severity=ERROR) AND timestamp >= "${res.requestStartTime}"`,
25
+ resourceNames: [`projects/${(0, is_in_cloud_task_1.getProjectId)()}`],
26
+ filter: `logName=projects/${(0, is_in_cloud_task_1.getProjectId)()}/logs/run.googleapis.com%2Fvarlog%2Fsystem AND (severity=WARNING OR severity=ERROR) AND timestamp >= "${res.requestStartTime}"`,
26
27
  };
27
28
  const logCheckCountdown = cli_1.CliInternals.createOverwriteableCliOutput({
28
29
  quiet: cli_1.CliInternals.quietFlagProvided(),
@@ -0,0 +1,2 @@
1
+ export declare const isInCloudTask: () => boolean;
2
+ export declare const getProjectId: () => string | undefined;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProjectId = exports.isInCloudTask = void 0;
4
+ const isInCloudTask = () => {
5
+ if (process.env.REMOTION_GCP_PROJECT_ID)
6
+ return false;
7
+ if (process.env.K_CONFIGURATION && process.env.GCLOUD_PROJECT) {
8
+ return true;
9
+ }
10
+ return false;
11
+ };
12
+ exports.isInCloudTask = isInCloudTask;
13
+ const getProjectId = () => {
14
+ return (0, exports.isInCloudTask)()
15
+ ? process.env.GCLOUD_PROJECT
16
+ : process.env.REMOTION_GCP_PROJECT_ID;
17
+ };
18
+ exports.getProjectId = getProjectId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cloudrun",
3
- "version": "4.0.44",
3
+ "version": "4.0.46",
4
4
  "description": "GCP Cloud Run alternative to lambda rendering",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -11,11 +11,11 @@
11
11
  "@google-cloud/resource-manager": "^4.3.0",
12
12
  "@google-cloud/logging": "^10.5.0",
13
13
  "google-auth-library": "^8.7.0",
14
- "zod": "^3.21.4",
15
- "@remotion/bundler": "4.0.44",
16
- "@remotion/renderer": "4.0.44",
17
- "@remotion/cli": "4.0.44",
18
- "remotion": "4.0.44"
14
+ "zod": "^3.22.3",
15
+ "@remotion/bundler": "4.0.46",
16
+ "@remotion/cli": "4.0.46",
17
+ "remotion": "4.0.46",
18
+ "@remotion/renderer": "4.0.46"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@jonny/eslint-config": "3.0.266",
@@ -26,7 +26,7 @@
26
26
  "prettier-plugin-organize-imports": "^3.2.2",
27
27
  "ts-node": "^10.8.0",
28
28
  "vitest": "0.24.3",
29
- "@remotion/compositor-linux-x64-gnu": "4.0.44"
29
+ "@remotion/compositor-linux-x64-gnu": "4.0.46"
30
30
  },
31
31
  "exports": {
32
32
  "./package.json": "./package.json",