heroku / heroku-buildpack-go

Heroku Go Buildpack
https://devcenter.heroku.com/categories/go
MIT License
792 stars 511 forks source link

Requested file unknown to the buildpack #495

Closed o-ohst closed 8 months ago

o-ohst commented 2 years ago

While trying to deploy my app to heroku via git, I encountered this issue:

-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/go
-----> Go app detected
-----> Fetching stdlib.sh.v8... done
-----> 
       Detected go modules via go.mod
-----> 
       Detected Module Name: github.com/o-ohst/xxx
-----> 
-----> New Go Version, clearing old cache
-----> Installing go1.17
 !!    
 !!    The requested file (go1.17.linux-amd64.tar.gz) is unknown to the buildpack!
 !!    
 !!    The buildpack tracks and validates the SHA256 sums of the files
 !!    it uses. Because the buildpack doesn't know about the file
 !!    it likely won't be able to obtain a copy and validate the SHA.
 !!    
 !!    To find out more info about this error please visit:
 !!        https://devcenter.heroku.com/articles/unknown-go-buildack-files
 !!    
 !     Push rejected, failed to compile Go app.
 !     Push failed

The app had successfully been running on go 1.17 before, but I have not been able to deploy new changes since then

My go.mod file says "go 1.17". I also tried adding the heroku goVersion options but it did not work.

joshwlewis commented 2 years ago

@o-ohst go 1.17 in my go.mod works fine for me and resolves to go1.17.10 during the build. go1.17.linux-amd64.tar.gz is known to the latest versions of the buildpack, as far as I can tell. Maybe check the output of heroku buildpacks --app yourappname to make sure you aren't using an older or forked buildpack version. Otherwise, I'd suggest opening a ticket at help.heroku.com so we can dig into your app.

edmorley commented 2 years ago

make sure you aren't using an older or forked buildpack version

The build log shows the latest stable release being used:

-----> Using buildpack: heroku/go

My first thought was that there were stray unicode/control characters in the requested version string, that weren't immediately visible in the log output, however checking now that doesn't seem to be the case.

The only thing I can think of here is if the jq invocation is exiting non-zero for a reason other than the archive not being in the data file. eg: Different jq version, or something that isn't the real jq being on PATH ahead of the stack image jq? Although loadEnvDir() in this buildpack appears to only propagate an allowlist of env vars from the app config, and PATH isn't one of them.

candland commented 1 year ago

Was anything found to fix this? Getting this with Go 1.20.5

joshwlewis commented 1 year ago

@candland this issue may show up if you are using an older version of the buildpack with a newer version of go. I just tested and the latest release (https://github.com/heroku/heroku-buildpack-go/releases/tag/v175) seems to resolve go 1.20 in go.mod to 1.20.5 without an issue. Older versions of the buildpack don't know about 1.20.5.

candland commented 1 year ago

Thanks @joshwlewis! Specifying the buildpack fixed it.