Skip to content

🎥 Make videos programmatically with React

`@remotion/cloudrun`: Add type safety

Jonny Burger9e65d2fe5259
diff --git a/packages/cloudrun/src/api/deploy-service.ts b/packages/cloudrun/src/api/deploy-service.ts
index 2f215ed2de..797be85072 100644
--- a/packages/cloudrun/src/api/deploy-service.ts
+++ b/packages/cloudrun/src/api/deploy-service.ts
@@ -1,3 +1,4 @@
+import type {google} from '@google-cloud/run/build/protos/protos';
import type {LogLevel} from '@remotion/renderer';
import {wrapWithErrorHandling} from '@remotion/renderer/error-handling';
import {
@@ -89,10 +90,9 @@ const deployServiceRaw = async ({
};
}
- const request = {
+ const request: google.cloud.run.v2.ICreateServiceRequest = {
parent,
service: {
- // service structure: https://googleapis.dev/nodejs/run/latest/google.cloud.run.v2.IService.html
template: constructServiceTemplate({
memoryLimit,
cpuLimit,
@@ -106,6 +106,7 @@ const deployServiceRaw = async ({
// Run request
const [operation] = await cloudRunClient.createService(request);
+
const [response] = await operation.promise();
return {
diff --git a/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts b/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts
index 3be7042971..88e75368fc 100644
--- a/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts
+++ b/packages/cloudrun/src/api/helpers/construct-service-deploy-request.ts
@@ -1,3 +1,4 @@
+import type {google} from '@google-cloud/run/build/protos/protos';
import {VERSION} from 'remotion/version';
// taken from within the @google-cloud/run package, can't import it directly
@@ -19,7 +20,7 @@ export const constructServiceTemplate = ({
timeoutSeconds: number;
minInstances: number;
maxInstances: number;
-}) => {
+}): google.cloud.run.v2.IRevisionTemplate => {
return {
scaling: {
minInstanceCount: minInstances,