Reputation: 636
I cannot figure out why my cloud functions are not deploying, has anybody experienced this issue?
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?
Upvotes: 0
Views: 456
Reputation: 636
the issue was that I deployed openai in the root folder instead of the dang functions folder :p
Upvotes: 3