chore: Dynamically import email functions in authentication routes to optimize build process
Some checks failed
CI / skip-ci-check (push) Successful in 1m27s
CI / skip-ci-check (pull_request) Successful in 1m26s
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / lint-and-type-check (push) Has been cancelled
CI / lint-and-type-check (pull_request) Successful in 2m5s
CI / python-lint (pull_request) Successful in 1m51s
CI / test-backend (pull_request) Successful in 2m39s
CI / build (pull_request) Failing after 2m23s
CI / secret-scanning (pull_request) Successful in 1m40s
CI / dependency-scan (pull_request) Successful in 1m33s
CI / sast-scan (pull_request) Successful in 2m47s
CI / workflow-summary (pull_request) Successful in 1m25s
Some checks failed
CI / skip-ci-check (push) Successful in 1m27s
CI / skip-ci-check (pull_request) Successful in 1m26s
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / lint-and-type-check (push) Has been cancelled
CI / lint-and-type-check (pull_request) Successful in 2m5s
CI / python-lint (pull_request) Successful in 1m51s
CI / test-backend (pull_request) Successful in 2m39s
CI / build (pull_request) Failing after 2m23s
CI / secret-scanning (pull_request) Successful in 1m40s
CI / dependency-scan (pull_request) Successful in 1m33s
CI / sast-scan (pull_request) Successful in 2m47s
CI / workflow-summary (pull_request) Successful in 1m25s
This commit modifies the authentication routes to dynamically import email functions, preventing Resend initialization during the build. This change enhances the application's performance and reliability by ensuring that unnecessary initializations do not occur at build time. These updates contribute to a more efficient development workflow and improve the overall user experience.
This commit is contained in:
parent
36127ed97c
commit
a639189c23
@ -1,6 +1,5 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { prismaAuth } from '@/lib/db';
|
||||
import { generatePasswordResetToken, sendPasswordResetEmail } from '@/lib/email';
|
||||
import { isValidEmail } from '@/lib/utils';
|
||||
|
||||
// Force dynamic rendering to prevent Resend initialization during build
|
||||
@ -8,6 +7,9 @@ export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
// Dynamically import email functions to avoid Resend initialization during build
|
||||
const { generatePasswordResetToken, sendPasswordResetEmail } = await import('@/lib/email');
|
||||
|
||||
const body = await request.json();
|
||||
const { email } = body;
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { prismaAuth } from '@/lib/db';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { generateEmailConfirmationToken, sendEmailConfirmation } from '@/lib/email';
|
||||
import { isValidEmail } from '@/lib/utils';
|
||||
|
||||
// Force dynamic rendering to prevent Resend initialization during build
|
||||
@ -9,6 +8,9 @@ export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
// Dynamically import email functions to avoid Resend initialization during build
|
||||
const { generateEmailConfirmationToken, sendEmailConfirmation } = await import('@/lib/email');
|
||||
|
||||
const body = await request.json();
|
||||
const { email, password, name } = body;
|
||||
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { prismaAuth } from '@/lib/db';
|
||||
import { generateEmailConfirmationToken, sendEmailConfirmationResend } from '@/lib/email';
|
||||
|
||||
// Force dynamic rendering to prevent Resend initialization during build
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
// Dynamically import email functions to avoid Resend initialization during build
|
||||
const { generateEmailConfirmationToken, sendEmailConfirmationResend } = await import('@/lib/email');
|
||||
|
||||
const body = await request.json();
|
||||
const { email } = body;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user