Nat Serrano
Nat Serrano

Reputation: 636

Firebase Cloud function cannot be deployed

I cannot figure out why my cloud functions are not deploying, has anybody experienced this issue?

enter image description here

const functions = require("firebase-functions");
const { Configuration, OpenAIApi } = require("openai");

//create an image function
exports.createNewImage = functions.https.onCall(async (data, context) => {
  const textReceived = data.prompt; //basically the text sent

  const configuration = new Configuration({
    apiKey: process.env.OPENAI_API_KEY,
  });

  const openai = new OpenAIApi(configuration);

  return openai
    .createImage({
      prompt: textReceived,
      n: 2,
      size: "1024x1024",
    })
    .then((apiResponse) => {
      const imageUrl = apiResponse.data[0].url;
      return imageUrl;
    });
});

Logs say open ai is missing in json dependencies, but wasn't that installed when installed openai via npm? enter image description here

Upvotes: 0

Views: 456

Answers (1)

Nat Serrano
Nat Serrano

Reputation: 636

the issue was that I deployed openai in the root folder instead of the dang functions folder :p

Upvotes: 3

Related Questions