Heroku build succeeds but deploy fails (no code change) - heroku

I'm getting the following error in LogDNA:
(node:28) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '/tmp/build_[long-hash]/my-project-[long-hash]/node_modules/bluebird'
Process exited with status 0
State changed from starting to crashed
That line contains an import of Bluebird. When I remove the dependency and remove the line, then I get the same error, except it references the next line (which is also a dependency import).
When I deploy a branch that was previously working, I get the same error. Of course, I cannot re-pro this issue locally.
I compared the Dyno's npm list against my local, and they're the same. Also, all of the expected node_modules are, in fact, present in the Dyno's filesystem.
If I use Heroku-bash run the build task manually (with nothing special), then deploy, it's fine.

We had hard-coded/fixed the version of Electrode we're depending on, but Electrode has a fuzzy version for WebPack, which released a new version 5 days ago that caused this error. It causes the imports' paths to be incorrectly resolved/transpiled to the build directory instead of remain relative.
The workaround is to use require() instead of import.

Related

How to fix this Travis CI error that builds fine locally

I upgraded from xcode 10.1 to xcode 10.2.1. I needed to change a zendesk pod to satisfy swift 5. This builds fine locally but when travis CI tries to run this command from travis.yml file:
set -e
./.travis/scripts/setup_profiles.sh
./.travis/scripts/deploy_beta.sh "${WORKSPACE}" "${SCHEME}" "${TRAVIS_BUILD_NUMBER}"
set +e
I am getting an error and this is from the raw logs:
⌠error: Multiple commands produce '/Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework':
⌠error: Multiple commands produce '/Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
unexpected mutating task ('SetOwnerAndGroup travis:staff /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') with no relation to prior mutator ('SetOwnerAndGroup travis:staff /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') (in target 'nanopb-iOS11.0')
unexpected mutating task ('SetMode u+w,go-w,a+rX /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') with no relation to prior mutator ('SetMode u+w,go-w,a+rX /Users/travis/build/xxx/mobile-ios/.build/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/nanopb.framework') (in target 'nanopb-iOS11.0')
The problem was that I had duplicate frameworks. After deleting the dupes, the CI ran fine.

What causes this webpack code 2 error and how to solve it?

Cannot even build in sidekick after a simple change
I created a new Core/TS project in Sidekick, I built the app and developed some stuff, but later I changed the icon to a nicer one (which requires a new build, no HMR for this type of change obviously), now I cannot build my app (cloud build, because I don't have Android Studio).
I checked the /main/assets/app/ and the icons were successfully changed there and they were existed.
What is happening? How do I fix this big issue? My patience bottle with all these critical errors even after simple changes is getting emptied.
I also tried "removing .cloud and folder directories", and clicking "clean cloud processes", adding "clean" option, etc...
But none worked.
I also updated the webpack.config.js file, with node_modules.bin\update-ns-webpack --configs
The file got successfully updated, but still did not solve the problem and I still cannot build.
Still after many hours cannot cloud build my app in sidekick. I also tried tns platform remove android, tns install, etc, etc... none worked out.
this is the error message:
[00:00:18.521] [WARN] Executing webpack failed with exit code 2.
[00:00:18.681] [ERROR] clean-webpack-plugin: /mnt/storage/builds/_/af8fe992d35e76b54f5523261a83dac973ffc9ed/5.3.4/5.3.1/Spread/platforms/android/app/src/main/assets/app/**/* has been removed.
Executing webpack failed with exit code 2.
'Build failed with error code 2'.
[19-06-10 19:13:56.767] Couldn't enable debugging for EP7333JKFA, Error: Couldn't enable debugging for EP7333JKFA
at Errors.fail (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\common\errors.js:126:28)
at Errors.failWithoutHelp (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\common\errors.js:136:21)
at LiveSyncService.<anonymous> (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\livesync-service.js:253:30)
at Generator.next (<anonymous>)
at C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\livesync-service.js:13:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\livesync-service.js:9:12)
at LiveSyncService.enableDebuggingCoreWithoutWaitingCurrentAction (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\livesync-service.js:250:16)
at LiveSyncService.enableDebuggingCoreWithoutWaitingCurrentAction (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\common\decorators.js:67:47)
at LiveSyncService.<anonymous> (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\livesync-service.js:290:25)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Bridge\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\livesync-service.js:10:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
OUTPUT 2
EDIT:
SOLVED
https://github.com/NativeScript/sidekick-feedback/issues/384#issuecomment-508028462
I know this isn't an answer, but it is happening to me, too. I am running Nativescript 5.4.1. I can build with webpack, but as soon as I try to run with AOT or Uglify, I can't build and the error message isn't very helpful.
Try to remove and add 'nativescript-dev-webpack'-plugin using nativescript-sidekick-GUI, this resolve my issue...

PhoneGap Build: Error: NOT_FOUND_ERR (missing files)

When I try to use my app from PhoneGap Build, it seems to be missing images. When I check in the Chrome web inspector, it's also missing script files. Here are the errors:
cordova.js:314 Uncaught Error: NOT_FOUND_ERR
at fileService.js:77
at fail (FileEntry.js:88)
at Object.callbackFromNative (cordova.js:295)
at <anonymous>:1:9
cordova.js:312 Error in Error callbackId: File410316782 : Error: NOT_FOUND_ERR
cordova.js:314 Uncaught Error: NOT_FOUND_ERR
at fileService.js:77
at fail (FileEntry.js:88)
at Object.callbackFromNative (cordova.js:295)
at <anonymous>:1:9
.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
I know I didn't fail to include this file, because it was working before.
Most issues like this, as well as "Upload Error [2]", can be solved in PhoneGap Build by deleting the app and re-uploading. Don't worry about losing anything, since all of your settings are in your config files. It seems that PhoneGap has a tendency to inadvertently retain or misplace files.
I tend to just delete my app and re-upload every time I need to run a build, so I don't have to waste time installing and opening the app, only to find out it's missing files.

How to debug Errno::EIO error in Chef recipe using Chef::Provider::Git

I'm trying to use chef to check out a git repo to a windows client node.
This seems simple enough and I've got the following resource definition:
git "C:\\pathtocheckout" do
repo "https://gitserver/repo.git"
action [ :checkout, :sync]
end
But when this is reached by chef-client I get:
Errno::EIO: git[C:\pathtocheckout] (cookbook_name::test line 21) had an error: Errno::EIO: Input/output error - CreateProcessW
I've had a look at the stacktrace produced and it appears to be something to do with creating a process to run the git command - but this is the limit of my knowledge.
I've made sure git is installed on on Path, removed all other recipes from the run list, running as a different admin user and I've tried different repositories but all with the same error.
So I'm pretty stumped - anyone got a way I can dig into this error and see what is going on?

Where to put monger connection in Compojure app for Heroku?

I created a compojure app using lein new compojure mongotest with lein 2.0, and a Procfile web: lein ring server-headless $PORT. This worked fine, but now when I add
(def mongolab-url (System/getenv "MONGOLAB_URI"))
(println "mongolab-url")
(println mongolab-url)
(mg/connect-via-uri! mongolab-url)
when I try git push heroku master Heroku eventually gives me
Compiling mongotest.handler
mongolab-url
nil
Exception in thread "main" java.lang.NullPointerException, compiling:(handler.clj:13:1)
... 25 more
Compilation failed: Subprocess failed
Error encountered performing task 'compile' with profile(s): 'production'
Suppressed exit
! Failed to build.
! Push rejected, failed to compile Clojure (Leiningen 2) app
I added these lines at the top level of handler.clj. Some of the older documentation I see the connection is created in main, but that must have been for older versions of compojure, as there's no main anymore (that I've found) in the generated app. Where should the connection get established in the current version? (Or is my Procfile not right?)
(Yes, MONGOLAB_URI is defined in heroku config)
The answer that worked for me and seems most idiomatic is to put the above connection into a function init in that same file (myproject/handler.clj)
(defn init[] (mg/connect-via-uri! (System/getenv "MONGOLAB_URI")))
and update the project.clj file ring descriptor line from
:ring {:handler myproject.handler/app}
to
:ring {:handler myproject.handler/app :init myproject.handler/init}
You don't want side-effects (such as opening a database connection) to happen at namespace load time, which is effectively compile time. Often you can get away with such things, when you are compiling your code when clojure starts up, but in this case heroku is pre-compiling your app into a jar so that it can serve it up more quickly. Now, at compile time, you try to read the PORT environment variable; but it is not set until heroku tries to actually run your app.
The solution is to create it only at runtime, eg by doing so in -main, or in some other function, or by defining it as a delay which you only force at runtime.

Resources