ai icon indicating copy to clipboard operation
ai copied to clipboard

examples/next-huggingface doesn't work.

Open JDiegoRojas opened this issue 1 year ago • 2 comments

Description

Description: When entering any entry in the chat, the request does not materialize and you get the errors "failed to pipe response" and "ECONNRESET".

Environment: OS: Windows 10 Pro 22H2 Node version: v20.11.0 Next.js version: 14.1.1 AI SDK version: 3.0.22

How to reproduce the bug:

  1. pnpm create next-app --example https://github.com/vercel/ai/tree/main/examples/next-huggingface next-huggingface-app
  2. cd next-huggingface-app
  3. Set HUGGINGFACE_API_KEY in .env.local
  4. pnpm dev
  5. go to http://localhost:3000/
  6. Write something in the input.

Code example

> [email protected] dev C:\Users\USER\Desktop\chatlab2\next-huggingface-app
> next dev

  ▲ Next.js 14.1.1
   - Local:        http://localhost:3000
   - Environments: .env.local

 ✓ Ready in 4.1s
 ○ Compiling / ...
 ✓ Compiled / in 7.9s (485 modules)
 ✓ Compiled in 917ms (232 modules)
 ○ Compiling /favicon.ico ...
 ✓ Compiled /api/chat in 7.5s (670 modules)
 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DevServer.runEdgeFunction (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\next-server.js:1214:13)
    at async NextNodeServer.handleCatchallRenderRequest (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\next-server.js:245:37)
    at async DevServer.handleRequestImpl (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\base-server.js:808:17)
    at async C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\dev\next-dev-server.js:331:20
    at async Span.traceAsyncFn (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\trace\trace.js:151:20)
    at async DevServer.handleRequest (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\dev\next-dev-server.js:328:24)
    at async invokeRender (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\lib\router-server.js:136:21)
    at async handleRequest (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\lib\router-server.js:315:24)
    at async requestHandlerImpl (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\lib\router-server.js:339:13)
    at async Server.requestListener (C:\Users\USER\Desktop\chatlab2\next-huggingface-app\node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\server\lib\start-server.js:140:13) {
  [cause]: Error: Model requires a Pro subscription; check out hf.co/pricing to learn more. Make sure to include your HF token in your query.
      at streamingRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@huggingface/inference/dist/index.js:329:23)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async textGenerationStream (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]/node_modules/@huggingface/inference/dist/index.js:653:5)
      at async Object.pull (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/ai/dist/index.mjs:2214:37)
}
Error: aborted
    at connResetException (node:internal/errors:787:14)
    at abortIncoming (node:_http_server:793:17)
    at socketOnClose (node:_http_server:787:3)
    at Socket.emit (node:events:530:35)
    at TCP.<anonymous> (node:net:337:12)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'ECONNRESET'
}
 ⨯ uncaughtException: Error: aborted
    at connResetException (node:internal/errors:787:14)
    at abortIncoming (node:_http_server:793:17)
    at socketOnClose (node:_http_server:787:3)
    at Socket.emit (node:events:530:35)
    at TCP.<anonymous> (node:net:337:12)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'ECONNRESET'
}
 ⨯ uncaughtException: Error: aborted
    at connResetException (node:internal/errors:787:14)
    at abortIncoming (node:_http_server:793:17)
    at socketOnClose (node:_http_server:787:3)
    at Socket.emit (node:events:530:35)
    at TCP.<anonymous> (node:net:337:12)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'ECONNRESET'
}
 ○ Compiling /_error ...

Additional context

No response

JDiegoRojas avatar Apr 12 '24 22:04 JDiegoRojas

same problem

georgegiosue avatar Apr 12 '24 22:04 georgegiosue

Same !!! i didn't know what was the issue exactly i tried changing the api key but it's still giving the same error.

yasdev08 avatar Apr 13 '24 12:04 yasdev08