Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS SAM CLI instructions recommends invalid BuildProperties #5525

Closed
ianwremmel opened this issue Dec 6, 2023 · 5 comments · Fixed by #6504
Closed

AWS SAM CLI instructions recommends invalid BuildProperties #5525

ianwremmel opened this issue Dec 6, 2023 · 5 comments · Fixed by #6504
Assignees
Labels
docs Documentation creation, updates or corrections

Comments

@ianwremmel
Copy link

The instructions at https://www.prisma.io/docs/guides/deployment/serverless/deploy-to-aws-lambda#loading-required-files say to add the following to each function's Metadata.BuildProperties:

Loader:
  - .prisma=file
  - .so.node=file
AssetNames: '[name]'

However, in so doing, sam build fails with

Error: NodejsNpmEsbuildBuilder:EsbuildBundle - Esbuild Failed: ✘ [ERROR] Invalid option in build() call: "loader:"

and

Error: NodejsNpmEsbuildBuilder:EsbuildBundle - Esbuild Failed: ✘ [ERROR] Invalid option in build() call: "asset-names:"
@ianwremmel ianwremmel added the docs Documentation creation, updates or corrections label Dec 6, 2023
@ianwremmel ianwremmel changed the title AWS SAM CLI instructions reocommends invalid BuildProperties AWS SAM CLI instructions recommends invalid BuildProperties Dec 6, 2023
@nikolasburk
Copy link
Member

Hey @ianwremmel 👋 sorry for the delay on this! Do you recall if you found a solution for this issue by any chance?

@IsaacMM01
Copy link

Hi @nikolasburk I am working on implementing Prisma in a SAM application to enable queries with PostgreSQL. I came across the same documentation mentioned in the post, but as someone with limited experience in CloudFormation or AWS SAM, I find the process of setting it up in a layer a bit challenging. I read this post, Deploying Prisma with AWS Lambda Layers in CDK, as well as this one on deploying Prisma with Serverless, but they don’t fully work for local testing scenarios. Do you have any solutions or documentation that might help with a local setup?

@ianwremmel
Copy link
Author

ianwremmel commented Nov 11, 2024

Mostly, I just chose to ignore those instructions. As far as I can tell, the prisma schema file is not, in fact, necessary at runtime. It's been to long since I did most of this, so I don't remember the details, but this is my prisma config:

generator client {
  provider        = "prisma-client-js"
  binaryTargets   = ["native", "rhel-openssl-1.0.x"]
  previewFeatures = ["driverAdapters", "views"]
}

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}

My assumption is that, by using prisma-client-js, I don't need to the schema file or the compiled .node.so file.

@jharrell
Copy link
Member

jharrell commented Dec 4, 2024

@ianwremmel thanks for the clarity here! I'm going to open a pull request to remove this section. Totally possible this was required in the past and is no longer required.

@ianwremmel
Copy link
Author

Sounds good, but it's probably worth investigating whether or not the prisms-client-js is relevant. I vaguely recall the I had to use that because there was no practical way to deliver the natively compiled prisma driver in conjunction with Lambda's esbuild. It's possible those files are necessary when using the native driver.

@jharrell jharrell self-assigned this Dec 4, 2024
jharrell added a commit that referenced this issue Dec 6, 2024
Fixes #5525

Removed recommendations around bundling `.prisma` and `.so.node` files.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/prisma/docs/issues/5525?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation creation, updates or corrections
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants