Error: plugin is not a function

Hello Everyone.

I developed a webb app in firestore. I incorporared AI features that analyses text and make recomendations based on that text.

The AI functions was working create so I decided today to create the backend so that I can deploy a demo website. However after I created the back and the serer region I am getting various errors when using the AI. I mainly used Gemini to create the code for this app. Its been quite successfull in fixing bugs but has met its match with this error

So whenever I ask the build in AI to analyse text I get this error and I am not sure how to fix it

Unhandled Runtime Error

Error: plugin is not a function

Source

node_modules/genkit/src/genkit.ts (916:28)

Array.forEach

Genkit.configure

node_modules/genkit/src/genkit.ts (915:13)

new Genkit

node_modules/genkit/src/genkit.ts (179:10)

genkit

node_modules/genkit/src/genkit.ts (955:10)

src/ai/genkit.ts (12:24) @

  10 | const plugins = [googleAI.googleAI({ apiVersion: 'v1' })];
  11 |
> 12 | export const ai = genkit({
     |                        ^
  13 |   plugins,
  14 | });
  15 |

Call Stack

[project]/src/ai/genkit.ts [app-rsc] (ecmascript)

/home/user/studio/.next/server/chunks/ssr/[root of the server]__a4a343._.js (371:3)

instantiateModule

[turbopack]/build/runtime.ts (192:19)

getOrInstantiateModuleFromParent

[turbopack]/build/runtime.ts (252:10)

esmImport

[turbopack]/shared/runtime-utils.ts (215:18)

src/ai/flows/generate-quality-cap-flow.ts (0:0)

[project]/src/ai/flows/generate-quality-cap-flow.ts [app-rsc] (ecmascript)

/home/user/studio/.next/server/chunks/ssr/[root of the server]__a4a343._.js (439:3)

instantiateModule

/home/user/studio/.next/server/chunks/ssr/[turbopack]_runtime.js (520:23)

getOrInstantiateModuleFromParent

/home/user/studio/.next/server/chunks/ssr/[turbopack]_runtime.js (572:12)

esmImport

[turbopack]/shared/runtime-utils.ts (215:18)

/home/user/studio/.next/server/chunks/ssr/[root of the server]__a4a343._.js (449:160)

[project]/src/app/quality/[auditId]/actions.ts [app-rsc] (ecmascript, action, ecmascript)

/home/user/studio/.next/server/chunks/ssr/[root of the server]__a4a343._.js (494:3)

instantiateModule

/home/user/studio/.next/server/chunks/ssr/[turbopack]_runtime.js (520:23)

getOrInstantiateModuleFromParent

/home/user/studio/.next/server/chunks/ssr/[turbopack]_runtime.js (572:12)

commonJsRequire

[turbopack]/shared/runtime-utils.ts (240:18)

5f4cb06bc8feb1465a178be00254736329edfd8a

/home/user/studio/.next/server/chunks/ssr/[root of the server]__a4a343._.js (498:76)

Next.js

/home/user/studio/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (39:426)

async rk

/home/user/studio/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (38:8146)

async r3

/home/user/studio/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (41:1256)

async doRender

/home/user/studio/node_modules/next/dist/server/base-server.js (1427:30)

async cacheEntry.responseCache.get.routeKind

/home/user/studio/node_modules/next/dist/server/base-server.js (1576:40)

async DevServer.renderToResponseWithComponentsImpl

/home/user/studio/node_modules/next/dist/server/base-server.js (1496:28)

async DevServer.renderPageComponent

/home/user/studio/node_modules/next/dist/server/base-server.js (1924:24)

async DevServer.renderToResponseImpl

/home/user/studio/node_modules/next/dist/server/base-server.js (1962:32)

async DevServer.pipeImpl

/home/user/studio/node_modules/next/dist/server/base-server.js (922:25)

async NextNodeServer.handleCatchallRenderRequest

/home/user/studio/node_modules/next/dist/server/next-server.js (272:17)

async DevServer.handleRequestImpl

/home/user/studio/node_modules/next/dist/server/base-server.js (818:17)

async

/home/user/studio/node_modules/next/dist/server/dev/next-dev-server.js (339:20)

async Span.traceAsyncFn

/home/user/studio/node_modules/next/dist/trace/trace.js (154:20)

async DevServer.handleRequest

/home/user/studio/node_modules/next/dist/server/dev/next-dev-server.js (336:24)

async invokeRender

/home/user/studio/node_modules/next/dist/server/lib/router-server.js (179:21)

async handleRequest

/home/user/studio/node_modules/next/dist/server/lib/router-server.js (359:24)

async requestHandlerImpl

/home/user/studio/node_modules/next/dist/server/lib/router-server.js (383:13)

async Server.requestListener

/home/user/studio/node_modules/next/dist/server/lib/start-server.js (141:13)

Hi @Barry_Bolton ,
Are you in “Code” mode? If so, did you install the genkit package? You can install genkit from a package manager like npm.

If not already in your package.json file, type

npm install genkit @genkit-ai/googleai

into your terminal in Code mode.

HI DMS. Yes I am in code mode. I eventually just used a restore point. The genkit was installed but somewhere along the line Gemini just messed everything up I think

1 Like