Report this

What is the reason for this report?

App Platoform when add enviroment variables I have yarn command errors

Posted on January 5, 2022

Hi, how are you?

I am starting to test this service that is really very good and I am encountering quite strange behaviors;

When I generate the basic application with the commands to run the application it works perfectly for me, obviously the difference is that the application fails because I clearly need to add the environment variables. When I add the environment variables the commands in the compilation step stop working for me.

This would be the YAML that the commands work.

alerts:
- disabled: true
  rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
name: test-app
region: nyc
services:
- build_command: | -
    npm install pm2 -g
    yarn pre-build
    yarn tsc
  environment_slug: node-js
  github:
    branch: master
    deploy_on_push: true
    repo: dg / test-app
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xs
  name: test-app
  routes:
  - path: /
  run_command: pm2-runtime start ecosystem.config.js
  source_dir: /

This would be the result.

Running custom build command: npm install pm2 -g
 yarn pre-build
 yarn tsc
 npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random () in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
 / layers / heroku_nodejs-engine / nodejs / bin / pm2-runtime -> / layers / heroku_nodejs-engine / nodejs / lib / node_modules / pm2 / bin / pm2-runtime
 / layers / heroku_nodejs-engine / nodejs / bin / pm2 -> / layers / heroku_nodejs-engine / nodejs / lib / node_modules / pm2 / bin / pm2
 / layers / heroku_nodejs-engine / nodejs / bin / pm2-dev -> / layers / heroku_nodejs-engine / nodejs / lib / node_modules / pm2 / bin / pm2-dev
 / layers / heroku_nodejs-engine / nodejs / bin / pm2-docker -> / layers / heroku_nodejs-engine / nodejs / lib / node_modules / pm2 / bin / pm2-docker
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules / pm2 / node_modules / chokidar / node_modules / fsevents):
 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os": "darwin", "arch": "any"} (current: {"os": "linux", "arch": "x64"})
 
 + pm2@5.1.2
 added 181 packages from 200 contributors in 14.838s
 yarn run v1.22.17
 $ cpy --cwd = src --parents '** / *' '! ** / *. ts' ../dist/src
 Donate in 1.04s.
 yarn run v1.22.17
 $ tsc
 Done in 10.19s.

This result makes all the sense since it works well, except that when the application is executed it asks me for the environment variables (obvious thing).

Now when I add the environment variables even just one for testing it throws me this error.

+ pm2@5.1.2
added 181 packages from 200 contributors in 15.583s
yarn run v1.22.17
$ cpy --cwd = src --parents '** / *' '! ** / *. ts' ../dist/src
/ bin / sh: 1: cpy: not found
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 127.
yarn run v1.22.17
$ tsc
/ bin / sh: 1: tsc: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
building: exit status 127
ERROR: failed to build: exit status 1

This would be the yaml for the latter case.

alerts:
- disabled: true
  rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
name: test-app
region: nyc
services:
- build_command: | -
    npm install pm2 -g
    yarn pre-build
    yarn tsc
  environment_slug: node-js
  envs:
  - key: NODE_ENV
    scope: RUN_AND_BUILD_TIME
    value: production
  github:
    branch: master
    deploy_on_push: true
    repo: dg / test-app
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xs
  name: test-app
  routes:
  - path: /
  run_command: pm2-runtime start ecosystem.config.js
  source_dir: /

In summary if I add environment variables it stops working for me.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.