Dev Checkout /upload 500 error
MichaelJAndy opened this issue · comments
Installed pasteboard, switched to the dev checkout, with logging on after starting the server, and trying to upload a file, I'm getting a 500 error on the /upload directory which does not exist.
I went ahead and created an upload directory and still no luck :(
# ./run_local
Missing (optional) auth file: auth/amazon.js
Missing (optional) auth file: auth/google_analytics.js
Missing (optional) auth file: auth/hashing.js
Express server listening on port 4000
GET / 200 664ms - 2.86kb
GET /js/head/modernizr.min.js 200 2ms - 5.42kb
GET /css/main.css 200 1ms - 6.27kb
GET /js/head/prefixfree.min.js 200 0ms - 2.45kb
GET /js/head.js 200 1ms - 32b
GET /js/lib/jquery.min.js 200 0ms - 32.32kb
GET /js/lib/jquery.transit.min.js 200 0ms - 2.19kb
GET /js/common.js 200 0ms - 469b
GET /js/lib/canvas-to-blob.min.js 200 1ms - 532b
GET /js/lib/spin.min.js 200 0ms - 2.01kb
GET /js/modules/moduleloader.js 200 1ms - 326b
GET /js/modules/analytics.js 200 0ms - 944b
GET /css/main.css 304 1ms
GET /images/bg.png 200 6ms - 25.27kb
GET /js/modules/appflow.js 200 0ms - 2.22kb
GET /js/modules/copyandpaste.js 200 1ms - 923b
GET /js/modules/draganddrop.js 200 1ms - 973b
GET /js/modules/extensionhandler.js 200 0ms - 282b
GET /images/splash-image.png 200 2ms - 5.68kb
GET /images/splash-image-shine.png 200 1ms - 16.89kb
GET /images/chrome-icon.png 200 2ms - 2.94kb
GET /js/modules/filehandler.js 200 0ms - 1.85kb
GET /js/modules/imageeditor.js 200 1ms - 3.66kb
GET /js/modules/modalwindow.js 200 0ms - 870b
GET /js/modules/socketconnection.js 200 1ms - 461b
GET /js/modules/template.js 200 1ms - 734b
GET /js/modules/webcam.js 200 0ms - 1021b
GET /images/about-icon.png 200 1ms - 2.19kb
GET /js/main.js 200 1ms - 572b
GET /jstemplates/modalwindow.tmpl 200 2ms - 1.48kb
GET /jstemplates/about.tmpl 200 2ms - 1.58kb
GET /jstemplates/webcamwindow.tmpl 200 2ms - 180b
GET /images/webcam-icon.png 200 3ms - 2.98kb
GET /jstemplates/imageeditor.tmpl 200 2ms - 784b
POST /preupload 200 10ms - 13b
GET /images/image-bg.gif 200 4ms - 1.11kb
GET /images/delete-icon.png 200 3ms - 1.84kb
POST /upload 500 15ms - 21b
GET /images/modal-bg.png 200 1ms - 6.15kb
@beatbreaker82 Thanks for reporting this. When not using S3 for the images, the server tries to put them into the public/storage directory. I added the folder to the repo, so everything should work now.
Thanks @JoelBesada, I did a git pull, though I'm still getting the 500 error:
POST /upload 500 14ms - 21b
GET /images/modal-bg.png 304 2ms
I should have mentioned before I also tried adding the public/storage directory with no luck either:
# ls -la public/
total 20
drwxrwxrwx 5 http http 4096 Aug 18 04:33 .
drwxr-xr-x 12 http http 4096 Aug 19 00:32 ..
drwxr-xr-x 2 http http 4096 Aug 14 00:06 images
drwxr-xr-x 2 http http 4096 Aug 14 00:06 jstemplates
drwxrwxrwx 2 http http 4096 Aug 19 00:31 storage
I've temporarily given full permissions to the public and storage directories to ensure that permission problems aren't the cause.
@beatbreaker82 Hmm, I added some lines to log any error that might occur during upload. Could you pull the dev branch again and paste the terminal output?
Thanks @JoelBesada!
Here ya go - some problem with renaming the tmp file? It exists after checking for it.
li382-54 hostmane.net # git pull
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3)
Unpacking objects: 100% (4/4), done.
From https://github.com/JoelBesada/pasteboard
8b83570..7a95961 dev -> origin/dev
Updating 8b83570..7a95961
Fast-forward
controllers/main.coffee | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
li382-54 hostmane.net # ps -ef | grep pasteboard
root 12305 12263 0 05:26 pts/0 00:00:00 grep --colour=auto pasteboard
li382-54 hostmane.net # ./run_local
Missing (optional) auth file: auth/amazon.js
Missing (optional) auth file: auth/google_analytics.js
Missing (optional) auth file: auth/hashing.js
Express server listening on port 4000
GET / 304 925ms
GET /css/main.css 200 3ms - 6.27kb
GET /js/head/modernizr.min.js 200 2ms - 5.42kb
GET /js/head.js 200 0ms - 32b
GET /js/head/prefixfree.min.js 200 0ms - 2.45kb
GET /js/lib/jquery.min.js 200 0ms - 32.32kb
GET /js/lib/jquery.transit.min.js 200 0ms - 2.19kb
GET /js/common.js 200 1ms - 469b
GET /js/lib/canvas-to-blob.min.js 200 11ms - 532b
GET /js/lib/spin.min.js 200 1ms - 2.01kb
GET /js/modules/moduleloader.js 200 0ms - 326b
GET /js/modules/analytics.js 200 0ms - 944b
GET /js/modules/appflow.js 200 0ms - 2.22kb
GET /css/main.css 304 1ms
GET /js/modules/extensionhandler.js 200 1ms - 282b
GET /js/modules/copyandpaste.js 200 1ms - 923b
GET /js/modules/draganddrop.js 200 0ms - 973b
GET /images/bg.png 304 3ms
GET /images/splash-image.png 304 2ms
GET /images/splash-image-shine.png 304 1ms
GET /images/about-icon.png 304 1ms
GET /images/chrome-icon.png 304 1ms
GET /js/modules/imageeditor.js 200 1ms - 3.66kb
GET /js/modules/filehandler.js 200 0ms - 1.85kb
GET /js/modules/modalwindow.js 200 0ms - 870b
GET /js/modules/socketconnection.js 200 2ms - 461b
GET /js/modules/webcam.js 200 1ms - 1021b
GET /js/modules/template.js 200 0ms - 734b
GET /js/main.js 200 1ms - 572b
GET /jstemplates/modalwindow.tmpl 304 2ms
GET /jstemplates/webcamwindow.tmpl 304 1ms
GET /jstemplates/about.tmpl 304 2ms
GET /images/webcam-icon.png 304 1ms
GET /jstemplates/imageeditor.tmpl 304 1ms
POST /preupload 200 10ms - 13b
GET /images/image-bg.gif 304 1ms
GET /images/delete-icon.png 304 2ms
{ [Error: EXDEV, rename '/tmp/a9caafe395349a0f07c119bdf84d3e75']
errno: 52,
code: 'EXDEV',
path: '/tmp/a9caafe395349a0f07c119bdf84d3e75' }
POST /upload 500 17ms - 21b
GET /images/modal-bg.png 304 5ms
li382-54 hostname.net # ls -la /tmp/a9caafe395349a0f07c119bdf84d3e75
-rw-r--r-- 1 root root 1945 Aug 20 05:26 /tmp/a9caafe395349a0f07c119bdf84d3e75
@beatbreaker82 From what I can gather by some searching, the EXDEV error occurs when fs.rename tries to rename a file on a different device. Are your /tmp/ and the pasteboard app folder on two different disks?
@JoelBesada yep they sure are on different filesystems (I'd add that it's pretty common to have the /tmp / and /home dirs all on different mounts on most Linux systems - if not it's encouraged.)
hostname@li382-xx ~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 24G 2.1G 21G 10% /
devtmpfs 493M 0 493M 0% /dev
tmpfs 494M 0 494M 0% /dev/shm
tmpfs 494M 1.4M 493M 1% /run
tmpfs 494M 0 494M 0% /sys/fs/cgroup
tmpfs 494M 1.6M 493M 1% /tmp
As a workaround I'd imagine there'd be a way for me to just tell the code that my /tmp directory is just somewhere else?
@beatbreaker82 Hey, sorry for disappearing for a couple of days. I've updated the code to use https://npmjs.org/package/fs.extra to move the file, which should work cross-device. Could you pull the latest commit on dev, run npm install
, and let me know if it works now?
Thanks @JoelBesada, yes that's gotten me over the line, now I'm stuck elsewhere.
I can now attach the file through drag and drop, then it'll come back with the URL, when I use that URL I get stuck on a page that either gets stuck on the loading bar, or says the the image dosen't exist. Below are the debug logs: I double checked and the image does exist on the file system in the /public/storage folder and they look fine.
GET /29w4kJFF.png 304 88ms
GET /css/image.css 304 2ms
GET /js/head/modernizr.min.js 200 1ms - 5.42kb
GET /js/head/prefixfree.min.js 200 0ms - 2.45kb
GET /js/head.js 200 1ms - 32b
GET /js/lib/jquery.transit.min.js 200 0ms - 2.19kb
GET /js/lib/jquery.min.js 200 1ms - 32.32kb
GET /js/common.js 200 1ms - 469b
GET /js/lib/spin.min.js 200 0ms - 2.01kb
GET /js/modules/template.js 200 0ms - 734b
GET /js/modules/analytics.js 200 0ms - 944b
GET /js/modules/moduleloader.js 200 0ms - 326b
GET /js/modules/modalwindow.js 200 0ms - 870b
GET /images/bg.png 304 0ms
GET /images/twitter-icon.png 304 2ms
GET /images/facebook-icon.png 304 2ms
GET /css/image.css 304 0ms
GET /js/image.js 200 0ms - 1.58kb
GET /images/29w4kJFF.png/shorturl 500 0ms - 31b
GET /jstemplates/modalwindow.tmpl 304 0ms
[Error: Missing Google Analytics Credentials]
li382-54 storage # ls 29w4kJFF.png
29w4kJFF.png
I can't seem to reproduce this, do you have any more details? Does your browser console throw any errors?