diff --git a/apps/webapp/app/components/integrations/VercelOnboardingModal.tsx b/apps/webapp/app/components/integrations/VercelOnboardingModal.tsx index 28bfe5672c6..9b285db81ec 100644 --- a/apps/webapp/app/components/integrations/VercelOnboardingModal.tsx +++ b/apps/webapp/app/components/integrations/VercelOnboardingModal.tsx @@ -541,6 +541,9 @@ export function VercelOnboardingModal({ formData.append("atomicBuilds", JSON.stringify(atomicBuilds)); formData.append("discoverEnvVars", JSON.stringify(discoverEnvVars)); formData.append("syncEnvVarsMapping", JSON.stringify(syncEnvVarsMapping)); + if (fromMarketplaceContext) { + formData.append("origin", "marketplace"); + } if (nextUrl && fromMarketplaceContext && isGitHubConnectedForOnboarding) { formData.append("next", nextUrl); } diff --git a/apps/webapp/app/models/vercelIntegration.server.ts b/apps/webapp/app/models/vercelIntegration.server.ts index 2ec530047ab..82bedc6430f 100644 --- a/apps/webapp/app/models/vercelIntegration.server.ts +++ b/apps/webapp/app/models/vercelIntegration.server.ts @@ -1294,7 +1294,7 @@ export class VercelIntegrationRepository { ); if (envVarsResult.isErr()) { - logger.error("pullEnvVarsFromVercel: Failed to get env vars", { + logger.warn("pullEnvVarsFromVercel: Failed to get env vars", { triggerEnvType: mapping.triggerEnvType, vercelTarget: mapping.vercelTarget, error: envVarsResult.error.message, diff --git a/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx b/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx index 38ef50126cd..c806381f1aa 100644 --- a/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx +++ b/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx @@ -3,7 +3,8 @@ import { parse } from "@conform-to/zod"; import { CheckCircleIcon, LockClosedIcon, PlusIcon } from "@heroicons/react/20/solid"; import { Form, useActionData, useNavigation, useNavigate, useSearchParams, useLocation } from "@remix-run/react"; import { type ActionFunctionArgs, type LoaderFunctionArgs, json } from "@remix-run/server-runtime"; -import { typedjson, useTypedFetcher } from "remix-typedjson"; +import { redirect, +typedjson, useTypedFetcher } from "remix-typedjson"; import { z } from "zod"; import { OctoKitty } from "~/components/GitHubLoginButton"; import { Dialog, DialogContent, DialogHeader, DialogTrigger } from "~/components/primitives/Dialog"; @@ -39,6 +40,7 @@ import { findProjectBySlug } from "~/models/project.server"; import { findEnvironmentBySlug } from "~/models/runtimeEnvironment.server"; import { ProjectSettingsService } from "~/services/projectSettings.server"; import { logger } from "~/services/logger.server"; +import { triggerInitialDeployment } from "~/services/platform.v3.server"; import { requireUserId } from "~/services/session.server"; import { githubAppInstallPath, @@ -208,6 +210,18 @@ export async function action({ request, params }: ActionFunctionArgs) { ); if (resultOrFail.isOk()) { + // Trigger initial deployment for marketplace flows now that GitHub is connected + if (redirectUrl) { + try { + if (redirectUrl.includes("origin=marketplace")) { + await triggerInitialDeployment(projectId, { environment: "prod" }); + } + } catch (error) { + logger.error("Invalid redirect URL, skipping initial deployment trigger", { redirectUrl, error }); + // Invalid redirectUrl, skip initial deployment check + } + } + return redirectWithMessage( request, redirectUrl, diff --git a/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.vercel.tsx b/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.vercel.tsx index 1857a4abdf3..9f5be039e44 100644 --- a/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.vercel.tsx +++ b/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.vercel.tsx @@ -113,6 +113,7 @@ const CompleteOnboardingFormSchema = z.object({ syncEnvVarsMapping: z.string().optional(), next: z.string().optional(), skipRedirect: z.string().optional().transform((val) => val === "true"), + origin: z.string().optional(), }); const SkipOnboardingFormSchema = z.object({ diff --git a/apps/webapp/app/routes/vercel.connect.tsx b/apps/webapp/app/routes/vercel.connect.tsx index f1be58fe977..faf43ca35e6 100644 --- a/apps/webapp/app/routes/vercel.connect.tsx +++ b/apps/webapp/app/routes/vercel.connect.tsx @@ -69,7 +69,7 @@ export async function loader({ request }: LoaderFunctionArgs) { const parsed = VercelConnectSchema.safeParse(Object.fromEntries(url.searchParams)); if (!parsed.success) { - logger.error("Invalid Vercel connect params", { error: parsed.error }); + logger.warn("Invalid Vercel connect params", { error: parsed.error }); throw new Response("Invalid parameters", { status: 400 }); } @@ -77,7 +77,7 @@ export async function loader({ request }: LoaderFunctionArgs) { const validationResult = await validateVercelOAuthState(state); if (!validationResult.ok) { - logger.error("Invalid Vercel OAuth state JWT", { error: validationResult.error }); + logger.warn("Invalid Vercel OAuth state JWT", { error: validationResult.error }); if ( validationResult.error?.includes("expired") || @@ -109,7 +109,7 @@ export async function loader({ request }: LoaderFunctionArgs) { }); if (!project) { - logger.error("Project not found or access denied", { + logger.warn("Project not found or access denied", { projectId: stateData.projectId, userId, }); @@ -132,7 +132,7 @@ export async function loader({ request }: LoaderFunctionArgs) { }); if (!environment) { - logger.error("Environment not found", { + logger.warn("Environment not found", { projectId: project.id, environmentSlug: stateData.environmentSlug, }); diff --git a/apps/webapp/app/services/platform.v3.server.ts b/apps/webapp/app/services/platform.v3.server.ts index a27c512ef43..40e6d0487f1 100644 --- a/apps/webapp/app/services/platform.v3.server.ts +++ b/apps/webapp/app/services/platform.v3.server.ts @@ -639,6 +639,32 @@ export async function enqueueBuild( return result; } +export async function triggerInitialDeployment( + projectId: string, + options: { environment: "preview" | "prod" | "staging" } +): Promise { + if (!client) return; + + const [error, result] = await tryCatch(client.triggerInitialDeployment(projectId, options)); + + if (error) { + logger.warn("Error triggering initial deployment", { + projectId, + environment: options.environment, + error, + }); + return; + } + + if (!result.success) { + logger.warn("Failed to trigger initial deployment", { + projectId, + environment: options.environment, + error: result.error, + }); + } +} + function isCloud(): boolean { const acceptableHosts = [ "https://cloud.trigger.dev", diff --git a/apps/webapp/app/services/vercelIntegration.server.ts b/apps/webapp/app/services/vercelIntegration.server.ts index e2c118ffd39..5e9155a6b25 100644 --- a/apps/webapp/app/services/vercelIntegration.server.ts +++ b/apps/webapp/app/services/vercelIntegration.server.ts @@ -413,7 +413,7 @@ export class VercelIntegrationService { }); if (upsertResult.isErr()) { - logger.error("Failed to sync staging TRIGGER_SECRET_KEY to custom environment", { + logger.warn("Failed to sync staging TRIGGER_SECRET_KEY to custom environment", { projectId, newCustomEnvironmentId, error: upsertResult.error.message, diff --git a/apps/webapp/package.json b/apps/webapp/package.json index 48994376066..a34b0cf7f90 100644 --- a/apps/webapp/package.json +++ b/apps/webapp/package.json @@ -124,7 +124,7 @@ "@trigger.dev/core": "workspace:*", "@trigger.dev/database": "workspace:*", "@trigger.dev/otlp-importer": "workspace:*", - "@trigger.dev/platform": "1.0.24", + "@trigger.dev/platform": "1.0.25", "@trigger.dev/redis-worker": "workspace:*", "@trigger.dev/sdk": "workspace:*", "@types/pg": "8.6.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 854d4215447..71ffe506d30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -507,8 +507,8 @@ importers: specifier: workspace:* version: link:../../internal-packages/otlp-importer '@trigger.dev/platform': - specifier: 1.0.24 - version: 1.0.24 + specifier: 1.0.25 + version: 1.0.25 '@trigger.dev/redis-worker': specifier: workspace:* version: link:../../packages/redis-worker @@ -10529,8 +10529,8 @@ packages: react: ^18.2.0 react-dom: 18.2.0 - '@trigger.dev/platform@1.0.24': - resolution: {integrity: sha512-dg9/QWyNBCctbGhzr9U2vImUdJNR+2FqTHVTJfgrSq12BIBpwAfUiSfel1S/beEGltBKhi7KXkBAsk+9cFPPzQ==} + '@trigger.dev/platform@1.0.25': + resolution: {integrity: sha512-2xHol0uKwyBadXElXokuqQxsQ/0bNM0SoyX7fMl4eabbuzLYPEth1AAI1MwhF592JV3MJtVCr2POyNarw5kMXw==} '@types/acorn@4.0.6': resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==} @@ -19008,22 +19008,21 @@ packages: tar@6.1.13: resolution: {integrity: sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==} engines: {node: '>=10'} - deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting i@izs.me tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} - deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting i@izs.me tar@7.4.3: resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} engines: {node: '>=18'} - deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting i@izs.me tar@7.5.6: resolution: {integrity: sha512-xqUeu2JAIJpXyvskvU3uvQW8PAmHrtXp2KDuMJwQqW8Sqq0CaZBAQ+dKS3RBXVhU4wC5NjAdKrmh84241gO9cA==} engines: {node: '>=18'} - deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me tdigest@0.1.2: resolution: {integrity: sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==} @@ -22438,7 +22437,7 @@ snapshots: '@babel/traverse': 7.24.7 '@babel/types': 7.24.0 convert-source-map: 1.9.0 - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -22726,7 +22725,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.24.7 '@babel/parser': 7.27.5 '@babel/types': 7.27.3 - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -30740,7 +30739,7 @@ snapshots: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - '@trigger.dev/platform@1.0.24': + '@trigger.dev/platform@1.0.25': dependencies: zod: 3.23.8 @@ -33538,7 +33537,7 @@ snapshots: docker-modem@5.0.6: dependencies: - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 readable-stream: 3.6.0 split-ca: 1.0.1 ssh2: 1.16.0 @@ -34235,7 +34234,7 @@ snapshots: eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.59.6(eslint@8.31.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.29.1)(eslint@8.31.0): dependencies: - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 enhanced-resolve: 5.15.0 eslint: 8.31.0 eslint-module-utils: 2.7.4(@typescript-eslint/parser@5.59.6(eslint@8.31.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.31.0) @@ -35646,7 +35645,7 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 transitivePeerDependencies: - supports-color @@ -36023,7 +36022,7 @@ snapshots: istanbul-lib-source-maps@5.0.6: dependencies: '@jridgewell/trace-mapping': 0.3.25 - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -42059,7 +42058,7 @@ snapshots: vite-node@3.1.4(@types/node@20.14.14)(lightningcss@1.29.2)(terser@5.44.1): dependencies: cac: 6.7.14 - debug: 4.4.3(supports-color@10.0.0) + debug: 4.4.1 es-module-lexer: 1.7.0 pathe: 2.0.3 vite: 5.4.21(@types/node@20.14.14)(lightningcss@1.29.2)(terser@5.44.1)