Edit: I got it working. I was using AWS CodePipeli...
# orm-help
c
Edit: I got it working. I was using AWS CodePipeline to deploy which included a CodeBuild step. The build step was using
yarn
for installing and building, whereas Elastic Beanstalk installs with
npm
. I updated the CodeBuild step to also use
npm
and things seem to be working 🤞 Still interesting to note that Prisma v2 worked fine the whole time. I'm having trouble deploying Prisma to Elastic Beanstalk - I am able to deploy Prisma at version 2, but not at version 3. When using
prisma
and
@prisma/client
at version 3, the Elastic Beanstalk
npm --production install
command fails but with no obvious error message - I will leave the full logs as a reply to this message. Any ideas what might cause this? As I say, if I downgrade to version 2 then the deployment works fine. I have also tried running
npm --production install
locally with the same version of Node used in the EB build, and it also works fine.
Copy code
2021/10/02 10:28:50.684707 [INFO] Running command /bin/sh -c npm --production install
2021/10/02 10:29:20.316492 [INFO] 
> prisma@3.1.1 preinstall /var/app/staging/node_modules/prisma
> node scripts/preinstall-entry.js


> prisma@3.1.1 install /var/app/staging/node_modules/prisma
> node scripts/install-entry.js


> @prisma/engines@3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f postinstall /var/app/staging/node_modules/@prisma/engines
> node download/index.js


> core-js-pure@3.18.1 postinstall /var/app/staging/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

[96mThank you for using core-js ([94m <https://github.com/zloirock/core-js> [96m) for polyfilling JavaScript standard library![0m

[96mThe project needs your help! Please consider supporting of core-js:[0m
[96m>[94m <https://opencollective.com/core-js> [0m
[96m>[94m <https://patreon.com/zloirock> [0m
[96m>[94m <https://paypal.me/zloirock> [0m
[96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m

[96mAlso, the author of core-js ([94m <https://github.com/zloirock> [96m) is looking for a good job -)[0m


> @apollo/protobufjs@1.2.2 postinstall /var/app/staging/node_modules/@apollo/protobufjs
> node scripts/postinstall


> @prisma/client@3.1.1 postinstall /var/app/staging/node_modules/@prisma/client
> node scripts/postinstall.js

Prisma schema loaded from prisma/schema.prisma

âœ" Generated Prisma Client (3.1.1) to ./node_modules/@prisma/client in 3.42s
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient()
Copy code
2021/10/02 10:29:20.320079 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --production install failed with error signal: killed 

2021/10/02 10:29:20.320101 [INFO] Executing cleanup logic
2021/10/02 10:29:20.346476 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1633170560,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1633170560,"severity":"ERROR"}]}]}
r
There are some issues with the Node environment of Beanstalk where it only installs production dependencies, permission errors etc. If possible, I would suggest using the Docker environment and deploying your application. I personally had done something like this.
c
Thanks for the tip @Ryan. I had considered using a Docker environment, but didn't simply because I couldn't find an example of a CDK implementation with Elastic Beanstalk + Docker environment, nor much documentation. Any chance you've got an example?
r
You can use the above environment as a Dockerfile. As for the CDK, let me check if there’s something and get back to you 🙂
🙏 1
c
@Chris Tsongas here's a link to a Dockerfile that Ryan kindly left