You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
},
async (subject) => {
const prompt =
`Suggest an item for the menu of a ${subject} themed restaurant`;
const llmResponse = await generate({
model: gemini15Flash,
prompt: prompt,
config: {
temperature: 1,
},
});
return llmResponse.text();
}
);
`
Angular code: async textAI() { try { let ccc = httpsCallable(this.functions, "getMenu3") let b = await ccc("banana"); console.log(b) } catch (e) { console.log(e); } }
[REQUIRED] Steps to reproduce
Create Angular application with above code and deploy do fierbase hosting.
Create Firebase function in the same firebase project with above code. and deploy it as well
[REQUIRED] Expected behavior
error free response from getMenu3
[REQUIRED] Actual behavior
Error:
I replaced name of the project with -> aaa-bbb-ccc
Access to fetch at 'https://us-central1-aaa-bbb-ccc.cloudfunctions.net/getMenu3' from origin 'https://aaa-bbb-ccc.web.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
us-central1-aaa-bbb-ccc.cloudfunctions.net/getMenu3:1
Failed to load resource: net::ERR_FAILED
main-73FIL5CQ.js:32 FirebaseError: internal
Were you able to successfully deploy your functions?
No did not.
The text was updated successfully, but these errors were encountered:
If that doesn't work, you can also try following the steps at https://cloud.google.com/run/docs/authenticating/public#console-ui to enable public access to the Cloud Run service for your function. Note: With this, you may want to add some additional authorization checks in your authPolicy function above.
Related issues
node: v20.9.0
**firebase-functions:**5.0.0
**firebase-tools:**13.16.0
**firebase-admin:**13.16.0
[REQUIRED] Test case
fireabase functions code:
`configureGenkit({
plugins: [
firebase(), // Add projectId here
vertexAI(),
],
logLevel: "debug",
enableTracingAndMetrics: false,
});
export const getMenu3 = onFlow(
{
name: "getMenu3",
inputSchema: z.string(),
outputSchema: z.string(),
authPolicy: firebaseAuth((user) => {
}),
);
`
Angular code:
async textAI() { try { let ccc = httpsCallable(this.functions, "getMenu3") let b = await ccc("banana"); console.log(b) } catch (e) { console.log(e); } }
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
error free response from getMenu3
[REQUIRED] Actual behavior
Error:
I replaced name of the project with -> aaa-bbb-ccc
main-73FIL5CQ.js:32 FirebaseError: internal
Were you able to successfully deploy your functions?
No did not.
The text was updated successfully, but these errors were encountered: