reworkd / AgentGPT

🤖 Assemble, configure, and deploy autonomous AI Agents in your browser.
https://agentgpt.reworkd.ai
GNU General Public License v3.0
31.94k stars 9.25k forks source link

No typescript module when deploying AgentGPT in newer version Node.js, either in Vercel and Netlify. #1536

Open codenamedpkt opened 7 months ago

codenamedpkt commented 7 months ago

Please check that this issue hasn't been reported before.

Expected Behavior

Deploy successful and pages appear.

Current behaviour

It looks like you're trying to use TypeScript but do not have the required package(s) installed.

Steps to reproduce

npm i -g && npm up -g && npm audit fix --force && npm run build ran in console and reproduce errors.

Possible solution

Add vercel.json and netlify.toml and make sure all the components are sufficient and in possible latest version. Specifically, make sure typescript metioned in package.json and package-lock.json.

Which Operating Systems are you using?

Acknowledgements

codenamedpkt commented 7 months ago

Update:

npm i && npm up && npm audit fix --force && npm run build                                                                                                                  ─╯
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'agent-gpt@1.0.0',
npm WARN EBADENGINE   required: { node: '>=18.0.0 <19.0.0' },
npm WARN EBADENGINE   current: { node: 'v21.6.2', npm: '10.2.4' }
npm WARN EBADENGINE }

> agent-gpt@1.0.0 postinstall
> prisma generate

prisma:warn Prisma detected unknown OS "android" and may not work as expected. Defaulting to "linux".
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
prisma:warn Prisma detected unknown OS "android" and may not work as expected. Defaulting to "linux".

✔ Generated Prisma Client (4.13.0 | library) to ./node_modules/@prisma/client in 284ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient()


> agent-gpt@1.0.0 prepare
> cd .. && husky install next/.husky

husky - Git hooks installed

up to date, audited 1166 packages in 8s

286 packages are looking for funding
  run `npm fund` for details

5 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'agent-gpt@1.0.0',
npm WARN EBADENGINE   required: { node: '>=18.0.0 <19.0.0' },
npm WARN EBADENGINE   current: { node: 'v21.6.2', npm: '10.2.4' }
npm WARN EBADENGINE }
npm WARN deprecated @uiball/loaders@1.3.1: This package has been superceded by https://www.npmjs.com/package/ldrs

added 240 packages, removed 105 packages, changed 482 packages, and audited 1301 packages in 38s

310 packages are looking for funding
  run `npm fund` for details

2 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm WARN using --force Recommended protections disabled.
npm WARN audit Updating axios to 1.6.8, which is a SemVer major change.
npm WARN audit Updating next-auth to 4.24.7, which is outside your stated dependency range.

added 1 package, changed 2 packages, and audited 1302 packages in 6s

310 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> agent-gpt@1.0.0 build
> next build --no-lint

 ⚠ Linting is disabled
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

   Checking validity of types  ..Failed to compile.

./src/components/Input.tsx:39:13
Type error: Argument of type 'false | "" | 0 | 0n | "md:rounded-l-none" | null | undefined' is not assignable to parameter of type 'ClassValue'.
  Type '0n' is not assignable to type 'ClassValue'.

  37 |             "delay-50 h-15 w-full resize-none rounded-xl border-2 border-slate-7 bg-slate-1 p-2 text-sm tracking-wider text-slate-12 outline-none transition-all selection:bg-sky-300 placeholder:text-slate-8 hover:border-sky-200 focus:border-sky-400 sm:h-20 md:text-lg",
  38 |             props.disabled && "cursor-not-allowed",
> 39 |             props.left && "md:rounded-l-none",
     |             ^
  40 |             props.small && "text-sm sm:py-[0]"
  41 |           )}
  42 |           ref={props.inputRef as RefObject<HTMLTextAreaElement>}

We have some issue when using all of latest components in latest NODE.js.

codenamedpkt commented 7 months ago

Another Update:

Diagnosis

The build failed during the 'building site' stage with a type error in the file auth/index.ts at line 30.

The specific error is:

Type error: Argument of type ((user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>) | undefined is not assignable to type (user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>.

Solution

To fix this error, you need to ensure that prismaAdapter.createUser is assigned a valid function of type (user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>. The error indicates that undefined is being assigned instead of a function which causes the type mismatch.

You should review the logic around prismaAdapter.createUser assignment in auth/index.ts to make sure that the correct function is assigned to it during the build process. Fixing this assignment should resolve the type error and allow the build to succeed.

This error occurs in Netlify when using NODE.js 20 latest LTS.