Cloud Foundry Error: negative offset

Table of Contents

Error

root@ubuntu:~# cf push first-push -p summit-hands-on-labs/basel-2018/first-push/first-push-app.jar -b java_buildpack --random-route
Pushing app first-push to org test-org / space test-space as admin...

readat /root/summit-hands-on-labs/basel-2018/first-push/first-push-app.jar: negative offset
FAILED

Solution

The cf cli supports either a ZIP archive or a folder as the path argument to cf push -p. It doesn't support tgz.

From cf push -h:
Path to app directory or to a zip file of the contents of the app directory

If you can bundle your app as a .zip, what you're trying should just work.

cf push first-push -p summit-hands-on-labs/basel-2018/first-push/first-push-app -b java_buildpack --random-route