reworkd / AgentGPT

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

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

Closed ralphilius closed 1 year ago

ralphilius commented 1 year ago

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

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?

Acknowledgements

ayush20501 commented 1 year ago

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

ice45571 commented 1 year ago

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

jasangill1 commented 1 year ago

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!!!