elixir-elm-tutorial / elixir-elm-tutorial-book

40 stars 12 forks source link

Phoenix Fails Compile on Heroku #28

Open oshybrid opened 3 years ago

oshybrid commented 3 years ago

Seems to be erroring out on a ")" But my project passes "mix test" The Heroku CLI on my laptop generates a secret... does it need to be manually put on Heroku?

remote: Restoring cached assets remote: sending incremental file list remote: ./ remote: remote: sent 63 bytes received 19 bytes 164.00 bytes/sec remote: total size is 0 speedup is 0.00 remote: Running custom compile remote:
remote: > @ deploy /tmp/build_1d2fbbd7/assets remote: > webpack --mode production remote:
remote: /tmp/build_1d2fbbd7/assets/node_modules/hard-source-webpack-plugin/index.js:105 remote: ); remote: ^ remote: SyntaxError: Unexpected token ) remote: at NativeCompileCache._moduleCompile (/tmp/build_1d2fbbd7/assets/node_modules/v8-compile-cache/v8-compile-cache.js:242:18) remote: at Module._compile (/tmp/build_1d2fbbd7/assets/node_modules/v8-compile-cache/v8-compile-cache.js:186:36) remote: at Object.Module._extensions..js (module.js:579:10) remote: at Module.load (module.js:487:32) remote: at tryModuleLoad (module.js:446:12) remote: at Function.Module._load (module.js:438:3) remote: at Module.require (module.js:497:17) remote: at require (/tmp/build_1d2fbbd7/assets/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) remote: at Object. (/tmp/build_1d2fbbd7/assets/webpack.config.js:3:33) remote: at Module._compile (/tmp/build_1d2fbbd7/assets/node_modules/v8-compile-cache/v8-compile-cache.js:194:30) remote: at Object.Module._extensions..js (module.js:579:10) remote: at Module.load (module.js:487:32) remote: at tryModuleLoad (module.js:446:12) remote: at Function.Module._load (module.js:438:3) remote: at Module.require (module.js:497:17) remote: at require (/tmp/build_1d2fbbd7/assets/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) remote: at WEBPACK_OPTIONS (/tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13) remote: at requireConfig (/tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6) remote: at /tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17 remote: at Array.forEach (native) remote: at module.exports (/tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15) remote: at yargs.parse.err (/tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/cli.js:71:45) remote: at Object.parse (/tmp/build_1d2fbbd7/assets/node_modules/yargs/yargs.js:576:18) remote: at /tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/cli.js:49:8 remote: at Object. (/tmp/build_1d2fbbd7/assets/node_modules/webpack-cli/bin/cli.js:366:3) remote: at Module._compile (module.js:570:32) remote: at Object.Module._extensions..js (module.js:579:10) remote: at Module.load (module.js:487:32) remote: at tryModuleLoad (module.js:446:12) remote: at Function.Module._load (module.js:438:3)

remote: npm ERR! Linux 4.4.0-1078-aws remote: npm ERR! argv "/tmp/build_1d2fbbd7/.heroku/node/bin/node" "/tmp/build_1d2fbbd7/.heroku/node/bin/npm" "run" "deploy" remote: npm ERR! node v6.9.2 remote: npm ERR! npm v3.10.9 remote: npm ERR! code ELIFECYCLE remote: npm ERR! @ deploy: webpack --mode production remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the @ deploy script 'webpack --mode production'. remote: npm ERR! Make sure you have the latest version of node.js and npm installed. remote: npm ERR! If you do, this is most likely a problem with the package, remote: npm ERR! not with npm itself. remote: npm ERR! Tell the author that this fails on your system: remote: npm ERR! webpack --mode production remote: npm ERR! You can get information on how to open an issue for this project with: remote: npm ERR! npm bugs remote: npm ERR! Or if that isn't available, you can get their info via: remote: npm ERR! npm owner ls remote: npm ERR! There is likely additional logging output above. remote:
remote: npm ERR! Please include the following file with any support request: remote: npm ERR! /tmp/build_1d2fbbd7/assets/npm-debug.log remote: ! Push rejected, failed to compile Phoenix app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to platform-application. remote: To https://git.heroku.com/platform-application.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/platform-application.git'

bradhutchins@MacBook-Pro platform % heroku config === platform-application Config Vars DATABASE_URL: postgres://hgujxzezikttph:1c4ec77deab3d61ddd0eb067be13e4738f31e17110be4e24fb82b0521dfefc25@ec2-184-72-162-198.compute-1.amazonaws.com:5432/d2pm80vlikigg3 SECRET_KEY_BASE: MRO58jwCBOFs1OP33HLx9tbyoWco33+9n2q/wNRgBtnNPIGJXXo3g+0ja/Jq7sLi bradhutchins@MacBook-Pro platform %

bradhutchins@MacBook-Pro platform % node -v v10.19.0 bradhutchins@MacBook-Pro platform % npm -v 6.14.4 bradhutchins@MacBook-Pro platform % elixir -v Erlang/OTP 23 [erts-11.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.11.0 (compiled with Erlang/OTP 23)

prod.exs

config :platform, PlatformWeb.Endpoint,
    http: [:inet6, port: System.get_env("PORT") || 4000],
    url: [scheme: "https", host: "platform-application.herokuapp.com", port: 443],
    force_ssl: [rewrite_on: [:x_forwarded_proto]],
    cache_static_manifest: "priv/static/cache_manifest.json",
    secret_key_base: Map.fetch!(System.get_env(), "SECRET_KEY_BASE")

# Database configuration
config :platform, Platform.Repo,
    adapter: Ecto.Adapters.Postgres,
    url: System.get_env("DATABASE_URL"),
    pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
    ssl: true

# Do not print debug messages in production
config :logger, level: :info
bijanbwb commented 3 years ago

Hey that's great to hear that you're working on a Heroku deploy.

If mix test is passing that sounds like good news and the Elixir code is probably good to go.

Based on the error messages it sounds like maybe that error is coming from some JavaScript code.

Perhaps it's something in the webpack.config.js file? Or something in app.js?

It's also possible that the node dependencies have changed at some point or that there's a compatibility issue with the version of node and Heroku.

remote: );
remote: ^
remote: SyntaxError: Unexpected token )

But based on the error message above it sounds like the first place to look is to check webpack.config.js and make sure the parentheses are in the right places. Sometimes formatters and IDEs (like VSCode) can help catch stuff like this too.

oshybrid commented 3 years ago

I can’t seem to find anything. Included a few files if you want to take a look. If you do look at them, any advice on where to check next? I am assuming this is all getting done on Heroku servers

Thank You

Brad Heroku Build Attempt.zip