Arjit Claude commited on
Commit ·
b3f1ddf
1
Parent(s): 978aec7
Fix Next.js 15 async params in API route
Browse filesChanges:
- Update API route handlers to use async params (Next.js 15 requirement)
- Fix TypeScript warning for unused request parameter
- Increment CACHEBUST to 9
This fixes the build error: "Type is not a valid type for the function's second argument"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +1 -1
- app/api/[...path]/route.ts +13 -10
Dockerfile
CHANGED
|
@@ -13,7 +13,7 @@ RUN npm install
|
|
| 13 |
|
| 14 |
# Force cache invalidation for source file changes
|
| 15 |
# Increment this value to force Docker to rebuild from this point
|
| 16 |
-
ARG CACHEBUST=
|
| 17 |
|
| 18 |
# Copy all necessary files for Next.js build
|
| 19 |
# Source files copied BEFORE config to invalidate cache when they change
|
|
|
|
| 13 |
|
| 14 |
# Force cache invalidation for source file changes
|
| 15 |
# Increment this value to force Docker to rebuild from this point
|
| 16 |
+
ARG CACHEBUST=9
|
| 17 |
|
| 18 |
# Copy all necessary files for Next.js build
|
| 19 |
# Source files copied BEFORE config to invalidate cache when they change
|
app/api/[...path]/route.ts
CHANGED
|
@@ -7,10 +7,11 @@ export const maxDuration = 300;
|
|
| 7 |
|
| 8 |
export async function GET(
|
| 9 |
request: NextRequest,
|
| 10 |
-
|
| 11 |
) {
|
| 12 |
-
const path =
|
| 13 |
-
const
|
|
|
|
| 14 |
|
| 15 |
try {
|
| 16 |
const response = await fetch(url, {
|
|
@@ -34,10 +35,11 @@ export async function GET(
|
|
| 34 |
|
| 35 |
export async function POST(
|
| 36 |
request: NextRequest,
|
| 37 |
-
|
| 38 |
) {
|
| 39 |
-
const path =
|
| 40 |
-
const
|
|
|
|
| 41 |
|
| 42 |
try {
|
| 43 |
const body = await request.json();
|
|
@@ -75,11 +77,12 @@ export async function POST(
|
|
| 75 |
}
|
| 76 |
|
| 77 |
export async function DELETE(
|
| 78 |
-
|
| 79 |
-
|
| 80 |
) {
|
| 81 |
-
const path =
|
| 82 |
-
const
|
|
|
|
| 83 |
|
| 84 |
try {
|
| 85 |
const response = await fetch(url, {
|
|
|
|
| 7 |
|
| 8 |
export async function GET(
|
| 9 |
request: NextRequest,
|
| 10 |
+
context: { params: Promise<{ path: string[] }> }
|
| 11 |
) {
|
| 12 |
+
const { path } = await context.params;
|
| 13 |
+
const pathString = path.join('/');
|
| 14 |
+
const url = `${BACKEND_URL}/api/${pathString}${request.nextUrl.search}`;
|
| 15 |
|
| 16 |
try {
|
| 17 |
const response = await fetch(url, {
|
|
|
|
| 35 |
|
| 36 |
export async function POST(
|
| 37 |
request: NextRequest,
|
| 38 |
+
context: { params: Promise<{ path: string[] }> }
|
| 39 |
) {
|
| 40 |
+
const { path } = await context.params;
|
| 41 |
+
const pathString = path.join('/');
|
| 42 |
+
const url = `${BACKEND_URL}/api/${pathString}`;
|
| 43 |
|
| 44 |
try {
|
| 45 |
const body = await request.json();
|
|
|
|
| 77 |
}
|
| 78 |
|
| 79 |
export async function DELETE(
|
| 80 |
+
_request: NextRequest,
|
| 81 |
+
context: { params: Promise<{ path: string[] }> }
|
| 82 |
) {
|
| 83 |
+
const { path } = await context.params;
|
| 84 |
+
const pathString = path.join('/');
|
| 85 |
+
const url = `${BACKEND_URL}/api/${pathString}`;
|
| 86 |
|
| 87 |
try {
|
| 88 |
const response = await fetch(url, {
|