Getting a json parse error on the quick tutorial

Hi all,

I’ve been going through the quick tutorial and I have followed all of the steps. But when actually generating the pet names , I’m met with an error. See below:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Any suggestions?

import { Configuration, OpenAIApi } from "openai";

const configuration = new Configuration({
  apiKey: process.env.OPEN_API_KEY,
const openai = new OpenAIApi(configuration);

// eslint-disable-next-line import/no-anonymous-default-export
export default async function (res) {
  const completion = await openai.createCompletion({
    model: "text-davinci-002",
    prompt: generatePrompt(req.body.idea),
    temperature: 0.6,
  res.status(200).json({ result:[0].text });


function generatePrompt(idea) {
  const capitalizedIdea = idea[0].toUpperCase() + idea.slice(1).toLowerCase();
  return `Suggest three names for a buisness.
  Idea: VR
  Names: Hyper, Vyper, Seeing is believing
  Idea: Finance
  Names: Money Matters, Money Time, Money Mine
  Animal: ${capitalizedIdea}

here is my generate.js file