prisma icon indicating copy to clipboard operation
prisma copied to clipboard

`Cannot fetch data from service:\n include is not a function` Error while using Next.js with AWS Lambda with Data Proxy

Open nurul3101 opened this issue 3 years ago • 0 comments

Bug description

As reported by the end user:

We are using Prisma 4.2.1 and our database is publicly accessible. Prisma itself was working perfectly fine with the direct database url. It only started failing recently in production when trying to integrate Data Proxy. I have attached screenshots of our configuration. We are using Nextjs with Prisma and the attached files show a simple backend request fetching data using Data Proxy, which should be hitting our database. We created a simple lib file to have a single instance of Prisma that we can import into our backend calls. When running the app in a dev environment and running the build files locally, there are no issues with connecting to Data Proxy and fetching and inserting data into our database. Debugging on our end, we have identified that the error is P5010, but are having trouble finding info on how to resolve this issue. Since we are using Serverless js, we have tried using the prisma/client/edge, as opposed to prisma/client because our application gets deployed to Cloudfront with Lambda@Edge, but we have noticed no difference. We have a .env file that imports the variables and have confirmed that the backend call is using the correct Data Proxy url.

CloudwatchLogs

Message Link for Internal Slack: https://prisma-company.slack.com/archives/C02GF9J74SH/p1654854367720369

How to reproduce

Reproduction code:

Sample-master.zip

Instructions to run the code are in the README.md file in zip folder.

AWS Configuration Images:

  1. database-config-sample
  2. database-config-sample-2
  3. database-config-sample-3
  4. database-config-sample-4
  5. database-config-sample-5

Error Logs Images:

  1. error-logs
  2. error-logs-2

Expected behavior

Should not get include is not a function error.

Prisma information

The Schema file is in the attached zip folder.

Environment & setup

  • Next.js with AWS Lambda

Prisma Version

Prisma Version 4.2.1

nurul3101 avatar Sep 19 '22 14:09 nurul3101