fix: add missing NoteHistory migration, fix manifest 403, add API error logging
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 43s
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 43s
- Commit untracked 20260428150000_add_note_history migration (creates NoteHistory table + noteHistory column) that was causing 500s in prod - Exclude static files (.json, .svg, .ico, etc.) from auth middleware to fix manifest.json 403 - Add console.error to echo API routes for production debug visibility Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,7 @@ export async function GET(req: NextRequest) {
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('[/api/ai/echo/connections] error:', error)
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to fetch connections' },
|
||||
{ status: 500 }
|
||||
|
||||
@@ -32,6 +32,7 @@ export async function GET(req: NextRequest) {
|
||||
return NextResponse.json({ insight })
|
||||
|
||||
} catch (error) {
|
||||
console.error('[/api/ai/echo] GET error:', error)
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to fetch Memory Echo insight' },
|
||||
{ status: 500 }
|
||||
@@ -84,6 +85,7 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('[/api/ai/echo] POST error:', error)
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to process request' },
|
||||
{ status: 500 }
|
||||
|
||||
@@ -7,5 +7,5 @@ export default NextAuth(authConfig).auth;
|
||||
|
||||
export const config = {
|
||||
// https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher
|
||||
matcher: ['/((?!api|_next/static|_next/image|.*\.png$).*)'],
|
||||
matcher: ['/((?!api|_next/static|_next/image|uploads|.*\.(png|json|svg|ico|jpg|jpeg|webp|woff2?)$).*)'],
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "NoteHistory" (
|
||||
"id" TEXT NOT NULL,
|
||||
"noteId" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"version" INTEGER NOT NULL,
|
||||
"reason" TEXT,
|
||||
"title" TEXT,
|
||||
"content" TEXT NOT NULL,
|
||||
"color" TEXT NOT NULL,
|
||||
"isPinned" BOOLEAN NOT NULL,
|
||||
"isArchived" BOOLEAN NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"checkItems" TEXT,
|
||||
"labels" TEXT,
|
||||
"images" TEXT,
|
||||
"links" TEXT,
|
||||
"isMarkdown" BOOLEAN NOT NULL,
|
||||
"size" TEXT NOT NULL,
|
||||
"notebookId" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "NoteHistory_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "UserAISettings"
|
||||
ADD COLUMN "noteHistory" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "NoteHistory_noteId_version_key" ON "NoteHistory"("noteId", "version");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NoteHistory_noteId_createdAt_idx" ON "NoteHistory"("noteId", "createdAt" DESC);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NoteHistory_userId_noteId_createdAt_idx" ON "NoteHistory"("userId", "noteId", "createdAt" DESC);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NoteHistory" ADD CONSTRAINT "NoteHistory_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NoteHistory" ADD CONSTRAINT "NoteHistory_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user