【问题标题】:CI/CD deployment of Prisma ORM to Elastic Beanstalk through CodePipeline通过 CodePipeline 将 Prisma ORM 部署到 Elastic Beanstalk 的 CI/CD
【发布时间】:2021-11-08 10:07:52
【问题描述】:

我正在尝试使用 Prisma ORM 部署一个简单的 ExpressJS 应用程序。 这是完整的项目:https://github.com/oxyn/aws-codebuild/settings

我正在尝试通过 Amazon CodePipeline 进行构建。对于构建,我选择了Ubuntu (aws/codebuild/standard:5.0)。据我所知,对于 Elastic,亚马逊使用的是 Amazon Unix

我指定了 binaryTargets:

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["rhel-openssl-1.0.x"]
}

但是,我仍然无法获取数据。

   "error": {
        "clientVersion": "3.0.2"
    },

这是我在 try-catch 中遇到的错误,这是来自 Elastic 的日志:

----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Sep 12 04:59:50 ip-172-31-12-243 web: /var/app/current/node_modules/.prisma/client
Sep 12 04:59:50 ip-172-31-12-243 web: To solve this problem, add the platform "rhel-openssl-1.0.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
Sep 12 04:59:50 ip-172-31-12-243 web: generator client {
Sep 12 04:59:50 ip-172-31-12-243 web: provider      = "prisma-client-js"
Sep 12 04:59:50 ip-172-31-12-243 web: binaryTargets = ["native"]
Sep 12 04:59:50 ip-172-31-12-243 web: }
Sep 12 04:59:50 ip-172-31-12-243 web: Then run "prisma generate" for your changes to take effect.
Sep 12 04:59:50 ip-172-31-12-243 web: Read more about deploying Prisma Client: https://pris.ly/d/client-generator
Sep 12 04:59:50 ip-172-31-12-243 web: at LibraryEngine.getLibQueryEnginePath (/var/app/current/node_modules/@prisma/client/runtime/index.js:25285:15)
Sep 12 04:59:50 ip-172-31-12-243 web: at async LibraryEngine.loadEngine (/var/app/current/node_modules/@prisma/client/runtime/index.js:24947:35)
Sep 12 04:59:50 ip-172-31-12-243 web: at async LibraryEngine.instantiateLibrary (/var/app/current/node_modules/@prisma/client/runtime/index.js:24913:7)

我在 post_build 部分生成 Prisma:

  post_build:
    commands:
      - echo Build completed on `date`
      - npm run generate

我做错了什么?

【问题讨论】:

  • 您需要在 CodeBuild 中使用 Amazon Linux 机器,而不是 Ubuntu,因为两者都有单独的二进制目标。
  • 谢谢。让我也试试这个。我在使用 Amazon Machine 时遇到了一些问题,但会尝试。谢谢
  • 我为构建尝试了不同的图像,但无论如何它都不起作用。 github.com/prisma/prisma/discussions/9241我也打开了问题。

标签: amazon-web-services amazon-elastic-beanstalk prisma


【解决方案1】:

我遇到了同样的问题。 我在 npm install 之后添加命令“npx prisma generate”

【讨论】:

  • 创建 .npmrc 文件并在里面设置 unsafe-perm=true... 或者,对于构建环境,在 EB 上设置 NPM_USE_PRODUCTION 这个环境变量,其值为 false... 也许两者都需要。不记得了:)
猜你喜欢
  • 2020-04-11
  • 2020-07-05
  • 2018-05-16
  • 2011-12-28
  • 2017-04-23
  • 2020-01-10
  • 2020-01-05
  • 2020-10-22
  • 2015-09-18
相关资源
最近更新 更多