Skip to content

Commit 6bce7df

Browse files
committed
fix(ci): fixed container registry name in ci, modified some routes to be dynamic to avoid nextjs telemetry
1 parent 717e17d commit 6bce7df

File tree

9 files changed

+39
-42
lines changed

9 files changed

+39
-42
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
if: github.event_name != 'pull_request'
3535
uses: docker/login-action@v3
3636
with:
37-
registry: simstudioai
37+
registry: ghcr.io
3838
username: ${{ github.repository_owner }}
3939
password: ${{ secrets.GITHUB_TOKEN }}
4040

apps/sim/app/api/function/execute/route.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { createContext, Script } from 'vm'
44
import { env } from '@/lib/env'
55
import { createLogger } from '@/lib/logs/console-logger'
66

7-
// Explicitly export allowed methods
8-
export const dynamic = 'force-dynamic' // Disable static optimization
9-
export const runtime = 'nodejs' // Use Node.js runtime
7+
export const dynamic = 'force-dynamic'
8+
export const runtime = 'nodejs'
109

1110
const logger = createLogger('FunctionExecuteAPI')
1211

apps/sim/app/api/webhooks/trigger/[path]/route.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ import { webhook, workflow } from '@/db/schema'
1717

1818
const logger = createLogger('WebhookTriggerAPI')
1919

20-
// Define Next.js config for webhook processing
21-
export const dynamic = 'force-dynamic' // Ensure dynamic rendering
22-
export const maxDuration = 300 // 5 minutes max execution time
20+
export const dynamic = 'force-dynamic'
21+
export const maxDuration = 300
2322

24-
// Storage for active processing tasks to prevent garbage collection
2523
const activeProcessingTasks = new Map<string, Promise<any>>()
2624

2725
/**

apps/sim/app/api/workspaces/invitations/accept/route.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import { NextRequest, NextResponse } from 'next/server'
22
import { randomUUID } from 'crypto'
33
import { and, eq } from 'drizzle-orm'
44
import { getSession } from '@/lib/auth'
5+
import { env } from '@/lib/env'
56
import { db } from '@/db'
67
import { user, workspace, workspaceInvitation, workspaceMember } from '@/db/schema'
78

8-
// GET /api/workspaces/invitations/accept - Accept an invitation via token
9+
export const dynamic = 'force-dynamic'
10+
11+
// Accept an invitation via token
912
export async function GET(req: NextRequest) {
1013
const token = req.nextUrl.searchParams.get('token')
1114

@@ -14,7 +17,7 @@ export async function GET(req: NextRequest) {
1417
return NextResponse.redirect(
1518
new URL(
1619
'/invite/invite-error?reason=missing-token',
17-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
20+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
1821
)
1922
)
2023
}
@@ -25,10 +28,7 @@ export async function GET(req: NextRequest) {
2528
// No need to encode API URL as callback, just redirect to invite page
2629
// The middleware will handle proper login flow and return to invite page
2730
return NextResponse.redirect(
28-
new URL(
29-
`/invite/${token}?token=${token}`,
30-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
31-
)
31+
new URL(`/invite/${token}?token=${token}`, env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai')
3232
)
3333
}
3434

@@ -44,7 +44,7 @@ export async function GET(req: NextRequest) {
4444
return NextResponse.redirect(
4545
new URL(
4646
'/invite/invite-error?reason=invalid-token',
47-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
47+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
4848
)
4949
)
5050
}
@@ -54,7 +54,7 @@ export async function GET(req: NextRequest) {
5454
return NextResponse.redirect(
5555
new URL(
5656
'/invite/invite-error?reason=expired',
57-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
57+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
5858
)
5959
)
6060
}
@@ -64,7 +64,7 @@ export async function GET(req: NextRequest) {
6464
return NextResponse.redirect(
6565
new URL(
6666
'/invite/invite-error?reason=already-processed',
67-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
67+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
6868
)
6969
)
7070
}
@@ -107,7 +107,7 @@ export async function GET(req: NextRequest) {
107107
return NextResponse.redirect(
108108
new URL(
109109
`/invite/invite-error?reason=email-mismatch&details=${encodeURIComponent(`Invitation was sent to ${invitation.email}, but you're logged in as ${userData?.email || session.user.email}`)}`,
110-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
110+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
111111
)
112112
)
113113
}
@@ -123,7 +123,7 @@ export async function GET(req: NextRequest) {
123123
return NextResponse.redirect(
124124
new URL(
125125
'/invite/invite-error?reason=workspace-not-found',
126-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
126+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
127127
)
128128
)
129129
}
@@ -151,10 +151,7 @@ export async function GET(req: NextRequest) {
151151
.where(eq(workspaceInvitation.id, invitation.id))
152152

153153
return NextResponse.redirect(
154-
new URL(
155-
`/w/${invitation.workspaceId}`,
156-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
157-
)
154+
new URL(`/w/${invitation.workspaceId}`, env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai')
158155
)
159156
}
160157

@@ -179,17 +176,14 @@ export async function GET(req: NextRequest) {
179176

180177
// Redirect to the workspace
181178
return NextResponse.redirect(
182-
new URL(
183-
`/w/${invitation.workspaceId}`,
184-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
185-
)
179+
new URL(`/w/${invitation.workspaceId}`, env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai')
186180
)
187181
} catch (error) {
188182
console.error('Error accepting invitation:', error)
189183
return NextResponse.redirect(
190184
new URL(
191185
'/invite/invite-error?reason=server-error',
192-
process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
186+
env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
193187
)
194188
)
195189
}

apps/sim/app/api/workspaces/invitations/details/route.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { NextRequest, NextResponse } from 'next/server'
2-
import { and, eq } from 'drizzle-orm'
2+
import { eq } from 'drizzle-orm'
33
import { getSession } from '@/lib/auth'
44
import { db } from '@/db'
55
import { workspace, workspaceInvitation } from '@/db/schema'
66

7-
// GET /api/workspaces/invitations/details - Get invitation details by token
7+
export const dynamic = 'force-dynamic'
8+
9+
// Get invitation details by token
810
export async function GET(req: NextRequest) {
911
const token = req.nextUrl.searchParams.get('token')
1012

apps/sim/app/api/workspaces/invitations/route.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import { NextRequest, NextResponse } from 'next/server'
22
import { render } from '@react-email/render'
33
import { randomUUID } from 'crypto'
4-
import { and, eq, inArray, sql } from 'drizzle-orm'
4+
import { and, eq, inArray } from 'drizzle-orm'
55
import { Resend } from 'resend'
66
import { WorkspaceInvitationEmail } from '@/components/emails/workspace-invitation'
77
import { getSession } from '@/lib/auth'
8+
import { env } from '@/lib/env'
89
import { db } from '@/db'
910
import { user, workspace, workspaceInvitation, workspaceMember } from '@/db/schema'
1011

11-
// Initialize Resend for email sending
12-
const resend = new Resend(process.env.RESEND_API_KEY)
12+
export const dynamic = 'force-dynamic'
1313

14-
// GET /api/workspaces/invitations - Get all invitations for the user's workspaces
14+
const resend = new Resend(env.RESEND_API_KEY)
15+
16+
// Get all invitations for the user's workspaces
1517
export async function GET(req: NextRequest) {
1618
const session = await getSession()
1719

@@ -53,7 +55,7 @@ export async function GET(req: NextRequest) {
5355
}
5456
}
5557

56-
// POST /api/workspaces/invitations - Create a new invitation
58+
// Create a new invitation
5759
export async function POST(req: NextRequest) {
5860
const session = await getSession()
5961

@@ -204,7 +206,7 @@ async function sendInvitationEmail({
204206
token: string
205207
}) {
206208
try {
207-
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
209+
const baseUrl = env.NEXT_PUBLIC_APP_URL || 'https://simstudio.ai'
208210
// Always use the client-side invite route with token parameter
209211
const invitationLink = `${baseUrl}/invite/${token}?token=${token}`
210212

@@ -217,7 +219,7 @@ async function sendInvitationEmail({
217219
)
218220

219221
await resend.emails.send({
220-
from: process.env.RESEND_FROM_EMAIL || '[email protected]',
222+
221223
to,
222224
subject: `You've been invited to join "${workspaceName}" on Sim Studio`,
223225
html: emailHtml,

apps/sim/app/api/workspaces/members/[id]/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { NextRequest, NextResponse } from 'next/server'
22
import { and, eq } from 'drizzle-orm'
33
import { getSession } from '@/lib/auth'
44
import { db } from '@/db'
5-
import { workspace, workspaceMember } from '@/db/schema'
5+
import { workspaceMember } from '@/db/schema'
66

7-
// PATCH /api/workspaces/members/[id] - Update a member's role
7+
// Update a member's role
88
export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
99
const { id } = await params
1010
const session = await getSession()

apps/sim/app/api/workspaces/members/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { NextResponse } from 'next/server'
22
import { and, eq } from 'drizzle-orm'
33
import { getSession } from '@/lib/auth'
44
import { db } from '@/db'
5-
import { user, workspace, workspaceMember } from '@/db/schema'
5+
import { user, workspaceMember } from '@/db/schema'
66

7-
// POST /api/workspaces/members - Add a member to a workspace
7+
// Add a member to a workspace
88
export async function POST(req: Request) {
99
const session = await getSession()
1010

apps/sim/app/api/workspaces/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { getSession } from '@/lib/auth'
44
import { db } from '@/db'
55
import { workflow, workspace, workspaceMember } from '@/db/schema'
66

7-
// GET /api/workspaces - Get all workspaces for the current user
7+
export const dynamic = 'force-dynamic'
8+
9+
// Get all workspaces for the current user
810
export async function GET() {
911
const session = await getSession()
1012

0 commit comments

Comments
 (0)