Team - I'm encountering an issue
1. What's Working:
- My Genkit flows work perfectly in the Genkit UI
- I can successfully trigger flows directly from the terminal
- The flow itself (
shortStoryFlowWithSchema) functions as expected when called directly2. The Problem:
- When trying to call the flow through my API endpoint (Firebase Function V1), I get this error:
- This occurs in:
firebase-functions/lib/v2/providers/https.js3. Project Setup:
- Existing Firebase Functions project using V1
- Genkit flow using
onFlow from @genkit-ai/firebase/functions- Using
.mjs extension for all Genkit-related files- Main API controller files are in CommonJS (
.js)- Using dynamic import bridge to connect ES Modules and CommonJS:
```javascript
exports.generateStory = async (...args) => {
const { generateStory } = await import("./generateStory.mjs");
return generateStory(...args);
};```
4. Questions:
- Is there a simpler solution to integrate Genkit flows with Firebase Functions V1?
- If not, do I need to create a separate Firebase Functions project using V2 specifically for Genkit flows? Would the recommended architecture be to have:
- V1 Functions project for existing endpoints
- V2 Functions project for Genkit flows
- Communication between them via API calls?
Any pointers? Love you turkeys! Thanks