The app upload is invalid: Symlink(s) point outside of root folder
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
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.
Maybe CloudFoundry should ignore uploading all symlinks pointing "outside folder"?
My deployment can not work, because of this "symlink" issue.
I'm also unable to deploy due to this issue.
You need to add “.cfignore” file to ignore folder “node_modules” (if Node.js) or any orher folder that has potential Symlinks pointing outside.
@MichaelOrtho I've tried that, but my Travis build fails when it tries to load something from devDependencies in package.json.
Try “before_build” in Travis CI with “rm -R ./node_modules”
@MichaelOrtho Did you mean "before_deploy" instead of "before_build"?
Sorry... Of course. Just add:
...
before_deploy:
- rm -R ./node_modules
...
Check this Travis deployment issue connected to CloudFoundry/Bluemix https://github.com/travis-ci/dpl/issues/734
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
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.
https://github.com/travis-ci/dpl/issues/734#issuecomment-357978383
Had the same issues just now. Deleted my node_modules folder, did cf push and it worked.
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
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.
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.
@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? https://github.com/cloudfoundry/cloud_controller_ng/issues/1057
Closing as wontfix for CLI. Fixed on Cloud Controller as mentioned in earlier comment.
For me this was caused by node_modules/.bin - just adding that to my .cfignore resolved things.
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 dependencieswhen 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.
For me this was caused by
node_modules/.bin- just adding that to my.cfignoreresolved things.
This worked for me .