🎥 Make videos programmatically with React
fix some issues
JonnyBurgerb13e02b96e9d
diff --git a/bun.lock b/bun.lockindex 6266a47a50..2a3fa4cb5e 100644--- a/bun.lock+++ b/bun.lock@@ -1087,6 +1087,7 @@"name": "@remotion/renderer","version": "4.0.375","dependencies": {+ "@remotion/licensing": "workspace:*","@remotion/streaming": "workspace:*","execa": "5.1.1","extract-zip": "2.0.1",@@ -1098,7 +1099,6 @@"@happy-dom/global-registrator": "14.5.1","@remotion/eslint-config-internal": "workspace:*","@remotion/example-videos": "workspace:*",- "@remotion/licensing": "workspace:*","@testing-library/dom": "10.4.0","@testing-library/react": "16.1.0","@types/node": "catalog:",diff --git a/packages/licensing/src/register-usage-point.ts b/packages/licensing/src/register-usage-point.tsindex 8a5cadd884..d08f82acd9 100644--- a/packages/licensing/src/register-usage-point.ts+++ b/packages/licensing/src/register-usage-point.ts@@ -31,31 +31,48 @@ export const registerUsageEvent = async ({succeeded: boolean;event: UsageEventType;}): Promise<RegisterUsageEventResponse> => {- const res = await fetch(`${HOST}/api/track/register-usage-point`, {- method: 'POST',- body: JSON.stringify({- event,- apiKey,- host,- succeeded,- }),- headers: {- 'Content-Type': 'application/json',- },- });- const json = (await res.json()) as ApiResponse;-- if (json.success) {- return {- billable: json.billable,- classification: json.classification,- };- }+ const abortController = new AbortController();+ const timeout = setTimeout(() => {+ abortController.abort();+ }, 10000);- if (!res.ok) {- throw new Error(json.error);- }+ try {+ const res = await fetch(`${HOST}/api/track/register-usage-point`, {+ method: 'POST',+ body: JSON.stringify({+ event,+ apiKey,+ host,+ succeeded,+ }),+ headers: {+ 'Content-Type': 'application/json',+ },+ signal: abortController.signal,+ });+ clearTimeout(timeout);++ const json = (await res.json()) as ApiResponse;++ if (json.success) {+ return {+ billable: json.billable,+ classification: json.classification,+ };+ }- const read = await res.json();- return read;+ if (!res.ok) {+ throw new Error(json.error);+ }++ const read = await res.json();+ return read;+ } catch (err) {+ clearTimeout(timeout);+ if (err instanceof Error && err.name === 'AbortError') {+ throw new Error('Request timed out after 5 seconds');+ }++ throw err;+ }};diff --git a/packages/renderer/package.json b/packages/renderer/package.jsonindex 4dccb3b693..bc8943890d 100644--- a/packages/renderer/package.json+++ b/packages/renderer/package.json@@ -25,7 +25,8 @@"remotion": "workspace:*","@remotion/streaming": "workspace:*","source-map": "^0.8.0-beta.0",- "ws": "8.17.1"+ "ws": "8.17.1",+ "@remotion/licensing": "workspace:*"},"peerDependencies": {"react": ">=16.8.0",@@ -40,7 +41,6 @@"@types/ws": "8.5.10","@remotion/example-videos": "workspace:*","@remotion/eslint-config-internal": "workspace:*",- "@remotion/licensing": "workspace:*","eslint": "catalog:","@types/node": "catalog:"},diff --git a/packages/renderer/tsconfig.json b/packages/renderer/tsconfig.jsonindex 6f536fe1a3..457d66ab2a 100644--- a/packages/renderer/tsconfig.json+++ b/packages/renderer/tsconfig.json@@ -5,5 +5,9 @@"outDir": "dist"},"include": ["src"],- "references": [{"path": "../core"}, {"path": "../streaming"}]+ "references": [+ {"path": "../core"},+ {"path": "../streaming"},+ {"path": "../licensing"}+ ]}