Skip to content

The OPENAI_API_KEY environment variable is missing or empty when deploy the project on vercel #53

@qingtian1771

Description

@qingtian1771

I add and .env file and change the content, but when I deploy the project to vercel, the project build successful, but I got following error when I access the web page.

Error: The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).
at (node_modules/openai/index.mjs:26:0)
at (app/function-calling.tsx:4:15)
at (webpack/bootstrap:21:0)
at (app/action.tsx:383:8)
at (webpack/bootstrap:21:0)
at (node_modules/next/dist/esm/server/lib/app-dir-module.js:10:0)
at (node_modules/next/dist/esm/lib/metadata/resolve-metadata.js:238:0)
at (node_modules/next/dist/esm/lib/metadata/resolve-metadata.js:290:0)
at (node_modules/next/dist/esm/lib/metadata/resolve-metadata.js:476:0)
at (node_modules/next/dist/esm/lib/metadata/metadata.js:39:0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions