Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in POST handler: ReferenceError: File is not defined #2

Open
sandipan1 opened this issue Jan 10, 2025 · 3 comments
Open

Error in POST handler: ReferenceError: File is not defined #2

sandipan1 opened this issue Jan 10, 2025 · 3 comments

Comments

@sandipan1
Copy link

sandipan1 commented Jan 10, 2025

I am getting this error when I run resume extraction

Details `Received files: [ File { size: 42130, type: 'application/pdf', name: 'resume_november.pdf', lastModified: 1736501089769 } ] Error in POST handler: ReferenceError: File is not defined at eval (webpack-internal:///(rsc)/./app/api/extract_resume/route.ts:59:41) at new Promise () at parsePDF (webpack-internal:///(rsc)/./app/api/extract_resume/route.ts:56:12) at POST (webpack-internal:///(rsc)/./app/api/extract_resume/route.ts:93:34) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async /Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:55755 at async eO.execute (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:46523) at async eO.handle (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:57089) at async doRender (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1359:42) at async cacheEntry.responseCache.get.routeKind (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1581:28) at async DevServer.renderToResponseWithComponentsImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1489:28) at async DevServer.renderPageComponent (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1920:24) at async DevServer.renderToResponseImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1958:32) at async DevServer.pipeImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:917:25) at async NextNodeServer.handleCatchallRenderRequest (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/next-server.js:272:17) at async DevServer.handleRequestImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:813:17) at async /Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/dev/next-dev-server.js:339:20 at async Span.traceAsyncFn (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/trace/trace.js:154:20) at async DevServer.handleRequest (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/dev/next-dev-server.js:336:24) at async invokeRender (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/router-server.js:173:21) at async handleRequest (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/router-server.js:350:24) at async requestHandlerImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/router-server.js:374:13) at async Server.requestListener (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/start-server.js:141:13) POST /api/extract_resume 500 in 1566ms `
@katia-openai
Copy link
Collaborator

Hi @sandipan1, have you tried with the example file provided?

The error suggests that there is an issue with the file, so would be curious to know if it happens with the example file as well.

@sandipan1
Copy link
Author

Yes it's the same error with sample file

Details

`> [email protected] dev

next dev

▲ Next.js 14.2.11

✓ Starting...
✓ Ready in 2.1s
○ Compiling / ...
✓ Compiled / in 4.4s (1807 modules)
⨯ TypeError: Promise.withResolvers is not a function
at webpack_require (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/webpack-runtime.js:33:42)
at eval (./components/file-dropper.tsx:12:67)
at (ssr)/./components/file-dropper.tsx (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/app/page.js:151:1)
at webpack_require (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/webpack-runtime.js:33:42)
at eval (./app/page.tsx:10:82)
at (ssr)/./app/page.tsx (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/app/page.js:129:1)
at Object.webpack_require [as require] (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/webpack-runtime.js:33:42)
digest: "1062468214"
GET / 500 in 5347ms
✓ Compiled in 1027ms (901 modules)
⨯ TypeError: Promise.withResolvers is not a function
at webpack_require (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/webpack-runtime.js:33:42)
at eval (./components/file-dropper.tsx:12:67)
at (ssr)/./components/file-dropper.tsx (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/app/page.js:151:1)
at webpack_require (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/webpack-runtime.js:33:42)
at eval (./app/page.tsx:10:82)
at (ssr)/./app/page.tsx (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/app/page.js:129:1)
at Object.webpack_require [as require] (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/.next/server/webpack-runtime.js:33:42)
digest: "1062468214"
GET / 500 in 113ms
○ Compiling /api/extract_resume ...
✓ Compiled /api/extract_resume in 600ms (1076 modules)
(node:45752) ExperimentalWarning: buffer.File is an experimental feature and might change at any time
(Use node --trace-warnings ... to show where the warning was created)
Received files: [
File {
size: 43967,
type: 'application/pdf',
name: 'example_resume.pdf',
lastModified: 1736540868287
}
]
Error in POST handler: ReferenceError: File is not defined
at eval (webpack-internal:///(rsc)/./app/api/extract_resume/route.ts:59:41)
at new Promise ()
at parsePDF (webpack-internal:///(rsc)/./app/api/extract_resume/route.ts:56:12)
at POST (webpack-internal:///(rsc)/./app/api/extract_resume/route.ts:93:34)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:55755
at async eO.execute (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:46523)
at async eO.handle (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:57089)
at async doRender (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1359:42)
at async cacheEntry.responseCache.get.routeKind (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1581:28)
at async DevServer.renderToResponseWithComponentsImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1489:28)
at async DevServer.renderPageComponent (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1920:24)
at async DevServer.renderToResponseImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:1958:32)
at async DevServer.pipeImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:917:25)
at async NextNodeServer.handleCatchallRenderRequest (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/next-server.js:272:17)
at async DevServer.handleRequestImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/base-server.js:813:17)
at async /Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/dev/next-dev-server.js:339:20
at async Span.traceAsyncFn (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/trace/trace.js:154:20)
at async DevServer.handleRequest (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
at async invokeRender (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/router-server.js:173:21)
at async handleRequest (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/router-server.js:350:24)
at async requestHandlerImpl (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/router-server.js:374:13)
at async Server.requestListener (/Users/sandipan/projects/AI/structured-outputs-samples/resume-extraction/node_modules/next/dist/server/lib/start-server.js:141:13)
POST /api/extract_resume 500 in 1175ms
`

@katia-openai
Copy link
Collaborator

Ok, I can't reproduce by using the version that's currently in the repo.
Could you please share:

  • The steps you've taken
  • The node version you're using
  • Your OS

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants