New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The app upload is invalid: Symlink(s) point outside of root folder #1299

Closed
dotchev opened this Issue Jan 10, 2018 · 19 comments

Comments

Projects
None yet
@dotchev

dotchev commented Jan 10, 2018

Command

I have a very simple node app

package.json

{
  "name": "test-link",
  "version": "1.0.0",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "express": "^4.16.2"
  }
}

server.js

let express = require('express');

let app = express();
app.use((req, res) => {
  res.send('OK');
});
app.listen(process.env.PORT);
npm install
cf push test-link

What occurred

Push failed with this error

Waiting for API to complete processing files...
Job (240257ea-c821-4026-bffa-041eb4492f3a) failed: The app upload is invalid: Symlink(s) point outside of root folder
FAILED

What you expected to occur

I expected push to succeed.
There is a single symlink and it points inside the app folder.

$ find . -type l
./node_modules/.bin/mime
$ ll ./node_modules/.bin/mime
lrwxr-xr-x  1 i031257  GLOBAL\Domain Users  14 Jan 10 10:20 ./node_modules/.bin/mime -> ../mime/cli.js

CLI Version

$ cf -v
cf version 6.34.0+f53d03a5e.2018-01-09

CC API Endpoint Version

$ cf api
api endpoint:   https://...
api version:    2.99.0

Platform & Shell Details

Mac OS 10.13.2

@cf-gitbot

This comment has been minimized.

Collaborator

cf-gitbot commented Jan 10, 2018

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/154202779

The labels on this github issue will be updated when the story is started.

@MichaelOrtho

This comment has been minimized.

MichaelOrtho commented Jan 19, 2018

Maybe CloudFoundry should ignore uploading all symlinks pointing "outside folder"?

@xi4oc4i

This comment has been minimized.

xi4oc4i commented Jan 22, 2018

My deployment can not work, because of this "symlink" issue.

@rkomiyama

This comment has been minimized.

rkomiyama commented Jan 22, 2018

I'm also unable to deploy due to this issue.

@MichaelOrtho

This comment has been minimized.

MichaelOrtho commented Jan 22, 2018

You need to add “.cfignore” file to ignore folder “node_modules” (if Node.js) or any orher folder that has potential Symlinks pointing outside.

@rkomiyama

This comment has been minimized.

rkomiyama commented Jan 22, 2018

@MichaelOrtho I've tried that, but my Travis build fails when it tries to load something from devDependencies in package.json.

@MichaelOrtho

This comment has been minimized.

MichaelOrtho commented Jan 22, 2018

Try “before_build” in Travis CI with “rm -R ./node_modules”

@rkomiyama

This comment has been minimized.

rkomiyama commented Jan 22, 2018

@MichaelOrtho Did you mean "before_deploy" instead of "before_build"?

@MichaelOrtho

This comment has been minimized.

MichaelOrtho commented Jan 22, 2018

Sorry... Of course. Just add:

...
before_deploy:
- rm -R ./node_modules
...

Check this Travis deployment issue connected to CloudFoundry/Bluemix
travis-ci/dpl#734

@clncln1

This comment has been minimized.

clncln1 commented Jan 22, 2018

The problem here is that - depending on your setup - it might not be possible to just delete node_modules. When having dependencies that are only available to your host running the build/deployment, but not to the CF environment, this workaround doesn't help.

I hope this will be fixed soon. In the meantime, if you need to push with modules, this helps:

npm install --no-bin-links

@MichaelOrtho

This comment has been minimized.

MichaelOrtho commented Jan 22, 2018

You can try to use bluemix custom script, but I would assume bluemix will be updated to include same "Simlinks" push so you will have same issue. This is using bluemix client (last build). Maybe we can pick previous version of cf before v6.34.

travis-ci/dpl#734 (comment)

@francisgauthier93

This comment has been minimized.

francisgauthier93 commented Jan 22, 2018

Had the same issues just now.
Deleted my node_modules folder, did cf push and it worked.

@cf-gitbot cf-gitbot added unscheduled and removed scheduled labels Jan 26, 2018

@dcolebatch

This comment has been minimized.

dcolebatch commented Jan 28, 2018

Looks like a known issue that many are going to hit as they follow the message PRO TIP: It is recommended to vendor the application's Node.js dependencies when pushing a node.js app.

http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring

@wileykestner

This comment has been minimized.

wileykestner commented Feb 18, 2018

Just came here to say that I experienced this issue out of the blue while trying to do an emergency re-deployment of a python web app using the python buildpack on PWS (a public instance of cloud foundry). Not a pleasant surprise!

If you do experience this error while deploying a python application with the python buildpack, the likely culprit is that you didn't add your virtualenvs folder to the .cfignore file. For instance, if your application's virtualenv folder is called env at the project root, you would add a line with env in it to the .cfignore file. That worked in my case and after adding it, I was able to do a successful deploy of my application.

I would have really appreciated a little bit more verbose feedback from the CLI to point me at the exact issue. For instance, the path to the offending symlink in question would have been really helpful. Thanks for taking the time to read the feedback, hope it was helpful.

@berlin-ab

This comment has been minimized.

berlin-ab commented Feb 24, 2018

We're still seeing this issue and are fixing our version of CF CLI to before 6.34 so that we're still able to deploy.

@jbpivotal

This comment has been minimized.

Member

jbpivotal commented Feb 27, 2018

@dotchev @xi4oc4i @rkomiyama @clncln1 @francisgauthier93 @dcolebatch @wileykestner @berlin-ab Looks like our colleagues on the CC team delivered a related fix. Does this solve your problem? cloudfoundry/cloud_controller_ng#1057

@jbpivotal jbpivotal added the wontfix label Mar 7, 2018

@jbpivotal

This comment has been minimized.

Member

jbpivotal commented Mar 7, 2018

Closing as wontfix for CLI. Fixed on Cloud Controller as mentioned in earlier comment.

@jbpivotal jbpivotal closed this Mar 7, 2018

@cf-gitbot cf-gitbot removed the accepted label Mar 7, 2018

@dnfield

This comment has been minimized.

dnfield commented Apr 18, 2018

For me this was caused by node_modules/.bin - just adding that to my .cfignore resolved things.

@gp2015

This comment has been minimized.

gp2015 commented Sep 14, 2018

Looks like a known issue that many are going to hit as they follow the message PRO TIP: It is recommended to vendor the application's Node.js dependencies when pushing a node.js app.

http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring

Ended up in this thread because a Python app failed with the error

The app upload is invalid: Symlink(s) point outside of root folder

Deleting virtualenv dir resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment