AgentGPT icon indicating copy to clipboard operation
AgentGPT copied to clipboard

Allow to configure which database type to deploy (for Vercel deployment)

Open ralphilius opened this issue 2 years ago • 1 comments

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

  • [X] I searched previous Bug Reports didn't find any similar reports.

Expected Behavior

Database should be working when deployed with postgresql

Current behaviour

[next-auth][error][adapter_error_getUserByAccount] 
https://next-auth.js.org/errors#adapter_error_getuserbyaccount 
Invalid `prisma.account.findUnique()` invocation:


error: Error validating datasource `db`: the URL must start with the protocol `file:`.
  -->  schema.prisma:7
   | 
 6 |   provider     = "sqlite"
 7 |   url          = env("DATABASE_URL")
   | 

Validation Error Count: 1 {
  message: '\n' +
    'Invalid `prisma.account.findUnique()` invocation:\n' +
    '\n' +
    '\n' +
    'error: Error validating datasource `db`: the URL must start with the protocol `file:`.\n' +
    '  -->  schema.prisma:7\n' +
    '   | \n' +
    ' 6 |   provider     = "sqlite"\n' +
    ' 7 |   url          = env("DATABASE_URL")\n' +
    '   | \n' +
    '\n' +
    'Validation Error Count: 1',
  stack: 'Error: \n' +
    'Invalid `prisma.account.findUnique()` invocation:\n' +
    '\n' +
    '\n' +
    'error: Error validating datasource `db`: the URL must start with the protocol `file:`.\n' +
    '  -->  schema.prisma:7\n' +
    '   | \n' +
    ' 6 |   provider     = "sqlite"\n' +
    ' 7 |   url          = env("DATABASE_URL")\n' +
    '   | \n' +
    '\n' +
    'Validation Error Count: 1\n' +
    '    at pn.handleRequestError (/var/task/next/node_modules/@prisma/client/runtime/library.js:176:6750)\n' +
    '    at pn.handleAndLogRequestError (/var/task/next/node_modules/@prisma/client/runtime/library.js:176:5907)\n' +
    '    at /var/task/next/node_modules/@prisma/client/runtime/library.js:179:3087\n' +
    '    at async /var/task/next/node_modules/@prisma/client/runtime/library.js:179:3294\n' +
    '    at async t._executeRequest (/var/task/next/node_modules/@prisma/client/runtime/library.js:179:10755)\n' +
    '    at async t._request (/var/task/next/node_modules/@prisma/client/runtime/library.js:179:10484)\n' +
    '    at async getUserByAccount (/var/task/next/node_modules/@next-auth/prisma-adapter/dist/index.js:213:29)',
  name: 'Error'
}
[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR] 
https://next-auth.js.org/errors#oauth_callback_handler_error 
Invalid `prisma.account.findUnique()` invocation:


error: Error validating datasource `db`: the URL must start with the protocol `file:`.
  -->  schema.prisma:7
   | 
 6 |   provider     = "sqlite"
 7 |   url          = env("DATABASE_URL")
   | 

Validation Error Count: 1 Error: 
Invalid `prisma.account.findUnique()` invocation:


error: Error validating datasource `db`: the URL must start with the protocol `file:`.
  -->  schema.prisma:7
   | 
 6 |   provider     = "sqlite"
 7 |   url          = env("DATABASE_URL")
   | 

Validation Error Count: 1
    at pn.handleRequestError (/var/task/next/node_modules/@prisma/client/runtime/library.js:176:6750)
    at pn.handleAndLogRequestError (/var/task/next/node_modules/@prisma/client/runtime/library.js:176:5907)
    at /var/task/next/node_modules/@prisma/client/runtime/library.js:179:3087
    at async /var/task/next/node_modules/@prisma/client/runtime/library.js:179:3294
    at async t._executeRequest (/var/task/next/node_modules/@prisma/client/runtime/library.js:179:10755)
    at async t._request (/var/task/next/node_modules/@prisma/client/runtime/library.js:179:10484)
    at async getUserByAccount (/var/task/next/node_modules/@next-auth/prisma-adapter/dist/index.js:213:29) {
  name: 'GetUserByAccountError',
  code: undefined
}

Steps to reproduce

  1. Deploy an instance with this template on Vercel: https://vercel.com/templates/next.js/agent-gpt
  2. Add a Supabase postgresql as DATABASE_URL
  3. Configure Github login with GITHUB_CLIENT_ID and GITHUB_SECRET_KEY

Possible solution

Maybe we could add database type as an environment variable?

Which Operating Systems are you using?

  • [ ] Android
  • [ ] iPhone/iPad
  • [ ] Linux
  • [X] macOS
  • [ ] Windows

Acknowledgements

  • [X] My issue title is concise, descriptive, and in title casing.
  • [X] I have searched the existing issues to make sure this bug has not been reported yet.
  • [X] I am using the latest version of AgentGPT.
  • [X] I have provided enough information for the maintainers to reproduce and diagnose the issue.

ralphilius avatar May 10 '23 06:05 ralphilius

can you tell me in detail how we can deploy it on vercel? i am getting page 404 error

ayush20501 avatar May 15 '23 02:05 ayush20501

can you tell me in detail how we can deploy it on vercel? i am getting page 404 error

Have you solved this problem, I also had this problem when I deployed with vercel

ice45571 avatar Jun 08 '23 13:06 ice45571

Hello @ice45571 @ayush20501 @ralphilius please refer to this new ticket for all updates on this issue : https://github.com/reworkd/AgentGPT/issues/715 !!! For now I will be closing this issue. Please message me if you have any further questions!!!

jasangill1 avatar Jul 08 '23 19:07 jasangill1