Vercel serverless environment errors with pdf-parse and OpenAI SDK

Problem

I am building a menu scanning app with PDF upload support using OPENAI_API_KEY directly (not AI Gateway). While image uploads work correctly, PDF processing fails in the Vercel serverless environment.

Errors Encountered

  1. OpenAI SDK Error:

Error: “Unsupported model version v1 for provider ‘openai.chat’”
Occurs when using the @ai-sdk/openai package.

  1. pdf-parse Library Error:

Error: “Cannot convert argument to a ByteString because the character at index 7 has a value of 8230”

Environment Details

  • The pdf-parse library appears to be incompatible with Vercel’s serverless environment.
  • Image uploads are functioning as expected.

Current Status

For now, the app works with photo uploads only. Users must take a photo of the menu instead of uploading a PDF.

To contact Vercel support directly, go to: vercel.com/help

Hey! To help debug your v0 project, could you share your v0 chat link?
It looks like https://v0.app/chat/... — you can copy it from your browser’s address bar while in the chat.

You’ll also need to unlist the chat so our team can view it — here’s how: Sharing | v0 Docs

This helps the team reproduce what you’re seeing much faster. Thanks!