Getting 401 Errors

It started generating an error again today:

error PineconeAuthorizationError: The API key you provided was rejected when calling https://chatindex-woi0itb.svc.gcp-starter.pinecone.io/vectors/upsert. Please check your configuration values and try again. You can find your project's configuration values in the Pinecone developer console at https://app.pinecone.io

The problem was resolved by updating the pinecone

npm install @pinecone-database/pinecone@latest

and changing the code

in

    const pinecone = new pinecone ({
      environment: process.env.PINECONE_ENVIRONMENT ?? '',
      apiKey: process.env.PINECONE_API_KEY ?? '',
    });

for

    const pinecone = new pinecone ({
      apiKey: process.env.PINECONE_API_KEY ?? '',
    });