Heroku, providing a deb dependency to Go project through APT buildpack does not work out - go

I have a PDF conversion package in my Go project which relies upon "wkhtmltox" debian package. I install "wkhtmltopdf" (similar to "wkhtmltox") through APT buildpack before running a Go buildpack. The "wkhtmltopdf" has been tested locally, and in this case Go project builds perfectly. But when I do it in Heroku, it does not work out, and fails with the same error as would pop out in case no "wkhtmltox" nor "wkhtmltopdf" was installed. The successfully installed "wkhtmltopdf" :
remote: -----> Installing wkhtmltopdf_0.12.5-1build1_amd64.deb
The error :
remote: ../codon/tmp/cache/go-path/pkg/mod/github.com/adrg/go-wkhtmltopdf#v0.2.2/converter.go:7:10: fatal error: wkhtmltox/pdf.h: No such file or directory
remote: 7 | #include <wkhtmltox/pdf.h>
remote: | ^~~~~~~~~~~~~~~~~
remote: compilation terminated.
Is there someone with similar experience ? Is it possible that for Go the installed package is simply not available without some additional manipulations ?

Related

Why is this Go build failing on Heroku? It builds locally with no issue

Is anyone able to tell me why this build has failed on heroku?
I've tried finding substitute packages and tidying the mod file, even deleting it and redoing it.
here is my build log
Overview Resources Deploy Metrics Activity Access Settings
Activity Feed Build LogID f8e9d5ce-0d8f-4e8e-8b2a-661c4d1f68f7
-----> Building on the Heroku-20 stack
-----> Go app detected
-----> Fetching stdlib.sh.v8... done
----->
Detected go modules via go.mod
----->
Detected Module Name: github.com/xxxxxx/xxxxxx-xxxxxx
----->
!! The go.mod file for this project does not specify a Go version
!!
!! Defaulting to go1.12.17
!!
!! For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
!!
-----> Using go1.12.17
-----> Determining packages to install
Detected the following main packages to install:
github.com/xxxxxx/xxxxxx-xxxxxx
-----> Running: go install -v -tags heroku github.com/xxxxxx/xxxxxx-companion
github.com/vektah/gqlparser/v2/ast
github.com/agnivade/levenshtein
github.com/mitchellh/mapstructure
github.com/vektah/gqlparser/v2/gqlerror
github.com/99designs/gqlgen/graphql
# github.com/99designs/gqlgen/graphql
../codon/tmp/cache/go-path/pkg/mod/github.com/99designs/gqlgen#v0.13.0/graphql/error.go:21:5: undefined: errors.As
github.com/99designs/gqlgen/graphql/errcode
github.com/vektah/gqlparser/v2/lexer
github.com/hashicorp/golang-lru/simplelru
github.com/vektah/gqlparser/v2/parser
github.com/hashicorp/golang-lru
github.com/gorilla/websocket
github.com/vektah/gqlparser/v2/validator
github.com/99designs/gqlgen/graphql/playground
github.com/xxxxxx/xxxxxx-xxxxxx/graph/model
github.com/xxxxxx/xxxxxx-xxxxxx/database
github.com/99designs/gqlgen/graphql/introspection
github.com/vektah/gqlparser/v2/validator/rules
github.com/go-sql-driver/mysql
github.com/vektah/gqlparser/v2
! Push rejected, failed to compile Go app.
! Push failed
Here is my go.mod file:
module github.com/xxxxxx/xxxxxx-xxxxxx
go 1.15
require (
github.com/99designs/gqlgen v0.13.0
github.com/go-sql-driver/mysql v1.5.0
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238 // indirect
github.com/stretchr/testify v1.5.1 // indirect
github.com/vektah/gqlparser/v2 v2.1.0
gopkg.in/yaml.v2 v2.2.8 // indirect
)
I'm at a complete loss, I suspect it has to do with an incorrect version, but the build log doesn't give me much to go on. How can I diagnose this kind of issue in the future?
Thank you.
You could add a directive // +heroku goVersion go1.15 in your go.mod file.
module somemodule
// +heroku goVersion go1.15
go 1.15
require (
// ...
)
Then it should look like this.
remote: Detected go modules via go.mod
remote: ----->
remote: Detected Module Name: somemodule
remote: ----->
remote: -----> New Go Version, clearing old cache
remote: -----> Installing go1.15
Documentation: https://github.com/heroku/heroku-buildpack-go#go-module-specifics
Go Module Specifics
You can specify specific package spec(s) via the go.mod file's // +heroku install directive (see below).
// +heroku goVersion <version>: the major version of go you would
like Heroku to use when compiling your code. If not specified this
defaults to the buildpack's [DefaultVersion].
Coming back to mark this one complete, I figured out that by specifying in the go mod file
// +heroku goVersion go1.15
Go buildback supports arbitrary comments specifiying versioning before build.
https://github.com/heroku/heroku-buildpack-go#go-module-specifics
Thank you as well to user #JimB for pointing me in the right direction.

Create-react-app build failing on heroku when using absolute paths

When using absolute paths in my CRA, the build step fails on heroku.
NODE_PATH=src/
Is in my .env.local file and also use this env var in my heroku settings.
I try to build my app on heroku using the "heroku-postbuild" script (which just runs "react-scripts build". I am using an express server to serve this build folder and to proxy requests to various API's.
this is the error I get:
remote: Running heroku-postbuild (yarn) remote: yarn run
v1.14.0 remote: $ react-scripts build remote: Creating
an optimized production build... remote: Failed to compile.
remote: remote: ./src/app/App.js remote: Cannot find
module: 'checklist/Checklist'. Make sure this package is installed.
remote: remote: You can install this package by running: yarn
add checklist/Checklist. remote: remote: remote: error Command failed
with exit code 1.
the Checklist.js file is located under: "src/checklist/Checklist.js"
Any idea what I need to do to make this work?
I had this issue and it seemed to be a result of my local file having a different casing than the one committed to git. i.e. if you have a file Checklist.js committed to git and are trying to import checklist from 'checlist/checklist.js', run git mv [...]/checklist.js [...]/Checklist.js.
See this issue comment for the original answer that got me here.
Just create a jsconfig.json file on the root of your project and paste this(if you use src as the starting point for your absolute imports
{
"compilerOptions": {
"baseUrl": "./src"
}
}

Aqueduct heroku deployment problems

I am trying to follow the official tutorial on how to deploy apps on Heroku
I am however getting the following error:
remote: Precompiled aqueduct:aqueduct.
remote: Precompiled test:test.
remote: *** Running pub build
remote: Building with "pub build"
remote: Dart 2 has a new build system. Learn how to migrate from pub build and
remote: pub serve: https://webdev.dartlang.org/dart-2
remote: ! Push rejected, failed to compile Dart app.
I can't seem to find any hints on what I can change to fix the error (It shouldn't really be using pub build or serve. unless aqueduct calls it under the hood)
have a web folder in the root of your project causes the buildpack to try and run 'pub build'

Error on mgo dependency when deploying go app to Heroku

I'm trying to deploy a Go App to Heroku, I'm using godeps for dependency management as their docs suggested.
But when I git push heroku master I get the following error telling that the file sasl.go doesn't exists.
remote: # github.com/grsouza/feeng-api/vendor/gopkg.in/mgo.v2/internal/sasl
remote: vendor/gopkg.in/mgo.v2/internal/sasl/sasl.go:15:24: fatal error: sasl/sasl.h: No such file or directory
remote: // #include <sasl/sasl.h>
remote: ^
remote: compilation terminated.
remote: github.com/grsouza/feeng-api/vendor/github.com/onsi/gomega
remote:
remote: ! Push rejected, failed to compile Go app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to limitless-ridge-36512.
remote:
To https://git.heroku.com/limitless-ridge-36512.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/limitless-ridge-36512.git'
Can anyone help me with this issue?
Thanks.
Do you use godep save ./... in your project?
If yes, delete the Godep and vendor directories and try to use godep save, without ./....
I do this and work for me.
Error tells sasl/sasl.h missing but not sasl.go. sasl.h header file is part of libsasl2-dev package which not installed on heroku and I don't know simple way to install it. To my mind you can try to find sasl headers on your local machine(most likely /usr/include/sasl)and copy to vendor/include/sasl in your local go app source. Then make them visible for CGO using heroku config vars doing
heroku config:set CGO_CFLAGS= -I/app/code/vendor/include/sasl
in heroku console, and than git push.
Also you can look for libsasl2-dev buildpack for heroku and try to use two buildpacks for your app with something like
heroku buildpacks:add heroku/some_libsasl2-dev
I finally found a solution (from https://github.com/go-mgo/mgo/issues/220#issuecomment-212658192):
run godep save ./... (to create the vendor directory with all the dependencies)
then re-run godep save without ./... (this will remove unused files)

play20 app (v. 2.0.2) deployment on heroku

Trying to get a play 2.0.2 application going on heroku and it seems it is not yet supported.
Has anyone had any luck with this?
Error:
http://s3pository.heroku.com/maven-scala-tools-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.11.3/sbt_2.9.1-0.11.3.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.11.3!sbt_2.9.1.jar:
http://s3pository.heroku.com/maven-scala-tools-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.11.3/sbt_2.9.1-0.11.3.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-tools.sbt#sbt_2.9.1;0.11.3: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-tools.sbt#sbt_2.9.1;0.11.3: not found
Error during sbt execution: Error retrieving required libraries
(see /tmp/build_7sg3kay36u6a/project/boot/update.log for complete log)
Error: Could not retrieve sbt 0.11.3
! Failed to build app with SBT 0.11.0
! Heroku push rejected, failed to compile Scala app
This was happening because of old cache (my app had been deployed on heroku before, hence the old cache)
From the root of your play application, do
heroku config:add BUILDPACK_URL='https://github.com/heroku/heroku-buildpack-scala#cleancache'
then push your app again
This will drop all cached artifacts and the sbt jar and re-download up to date fresh ones.
Just remember to do heroku config:remove BUILDPACK_URL afterwards or each time you push the cache will be dropped and builds will take a while.
Kudos to scott # play googlegroups
https://groups.google.com/forum/#!topic/play-framework/yUDfW2UtBjs
This could be unrelated, but I had some conflicting plugin in myhomedir/.sbt/plugins/build.sbt that messed up my Play 2.0.2 build. Removing that fixed it for me.
I had this exact error on my Mac and it was because MacPorts did not install the correct version of SBT (sudo port install sbt gave me 0.11.2 not 0.11.3) - yes I updated my port tree. So I sudo port uninstalled sbt and used brew install sbt. This (Homebrew) installed 0.11.3 and the problem disappeared. I would suggest checking the sbt version on Heroku.
If you encounter this on play 2.0.4 (I know, this question is for play 2.0.2, but it's first on google):
change the sbt version to 0.11.3:
Change sbt version in project/build.properties to 0.11.3

Resources