-
Notifications
You must be signed in to change notification settings - Fork 38
[BUG] Cant Upload Files #73
Comments
@Whitei520 according to #69 (comment) file uploads aren't supported on the standalone/self hosted infrastructure yet. |
|
@techmechanic1 did you set up the anything you are seeing in logs for |
This was closed but I still have the issue. My troubleshooting steps was not the solution, it was merely my steps to try and fix part of the problem. Even after getting the correct "filesServerUrl" showing up in the network logs I still get the same upload error. |
@Whitei520 could you send the output of also anything in the response body of that 400 call ? |
Here is the output of docker-compose logs -f files... Attaching to files-standalone The Files storage quota is showing 0 B of 0 B used... |
@techmechanic1 did you create a subscription for yourself? https://docs.standardnotes.com/self-hosting/subscriptions |
Yes, all the other premium features are working... |
Thanks for reopening. I checked the docker logs and found that the container did not have file permissions in the /data folder, I fixed that and now I can upload files without any errors. However I can't view or download any uploaded files. I get a 400 error in the network console with a response of "File download requires range header to be set." RESPONSE
REQUEST
As an extra troubleshooting step I also disabled Cloudflare proxy but the same error showed up. |
I had the similar bug, effectively coming from permissions. I had to run chmod -R 775 data
mkdir -p data/uploads
sudo chmod -R 755 data/uploads
sudo chown -R 1001.1001 data/uploads Maybe a permissions clarification would be needed in the documentation, but no other issue for me, everything running smoothly @techmechanic1: Have you seen the comment in the .env.sample file ? For my case, as I am hosting it in another computer, default configuration with localhost was not possible |
Thanks for that! @rofra I changed the permissions and changed the FILES_SERVER_URL and it works...I'm hosting the files on the same server but using localhost doesn't work anyway... |
@techmechanic1:Another clarification for the file upload, if you want to implement "Storage Quota", you could simply add an entry (per user) to set the quota. INSERT INTO subscription_settings(uuid, name, value, created_at, updated_at, user_subscription_uuid) VALUES (UUID(), "FILE_UPLOAD_BYTES_LIMIT", 10*10737418240, FLOOR(UNIX_TIMESTAMP(NOW(6))*1000000), FLOOR(UNIX_TIMESTAMP(NOW(6))*1000000), (SELECT us.uuid FROM user_subscriptions us INNER JOIN users u ON us.user_uuid=u.uuid WHERE u.email="my@email.com")); StandardNote Team, could you add the cleaner one to the official documentation ? |
Okay, well I finally found the problem I was having with "File download requires range header to be set." error. After adding this line to my nginx config everything is now fixed. This doesn't explain why it still wasn't working with Cloudflare disabled but I will leave that conundrum for someone else to solve. :)
I would strongly suggest this be added to the self hosted documentation for other people who use nginx and Cloudflare. |
Added everything mentioned in here to docs with this: standardnotes/docs@642df79 Thanks everyone for the input, hope it solves the issue :) |
@karolsojko: There is an error in the doumentationc, 1073741824 bytes shoud be 1Gb instead of 10G. In my original SQL Request, I put 10*10737418240 which was correct for 10G. |
Where did you put this? |
Having the same problem, cannot upload files keep getting the same error. This is my log from the files container.
files.env:
files part of my docker-compose file:
Any help how to solve this! |
@BobWs can you make sure auth and files have the same value on |
@karolsojko They are the same. They are both pulling the key from the |
@BobWs seems like you are missing the valet token in your request: https://github.com/standardnotes/files/blob/develop/src/Controller/ValetTokenAuthMiddleware.ts#L36 Do you have the latest version of the client application? Could you see what is sent in the request to files server - the valet token should be sent either in headers or in request parameters: https://github.com/standardnotes/files/blob/develop/src/Controller/ValetTokenAuthMiddleware.ts#L19 |
Yes I have the latest MacOS desktop client version 3.22.17.
|
After re-checking everything and recreated the containers I now get this in the error log
I don't know why it is showing permission denied, I have set the permission to 1001:1001 as mention above, I also tried to set it to root but still no go. What am I doing wrong? |
Hmm can't figure this out. so when you go to your FILES_SERVER_URL by typing it straight into the browser you should be getting something similar to this right? https://filesafe.standardnotes.org when I paste my custom URL I get and under developer tools you see example.mydomain.com/v1/files/valet-tokens:1 Failed to load resource: the server responded with a status of 403 () edit*** looking more closely in network it says {meta: {auth: {userUuid: "xxxxxxx-xxxxx-xxxxx-xxxxxx-xxxxxxxxxx,…},…},…} so for some reason still says no subcription despite me updating the database and all the other features working. any clue?? |
Files service is a different service than filesafe. Filesafe is a deprecated service. The FILES_SERVER_URL should be pointing to the file service you have running.
Did you follow these steps: https://docs.standardnotes.com/self-hosting/subscriptions Can you also verify if the record is in the database and the auth service is connected precisely to that database ? |
I reviewed everything I did and I realized in your script for adding subscriptions this subscription_type="regular";' \ was missing from the examples given by the other users in this chat. I added “regular” value to the row and now it works!! |
Just curious, where did you edit this? |
Under the server.sh file you can see the lines of code that handle the database modifications to add subscriptions.
Instead of running the script I just used phpmyadmin to modify the database manually. In the second command I was missing the subscription_type. On a side note, I am not sure if you figured out your header issue but I am using cloud flare and you need to add
to your reverse proxy. I am using Nginx |
Thanks for sharing! I followed the instructions for the pro plan from here: #64 and I see now that So do I need to do this all over for all my users or is there a easier way to get it done. For example how do I accomplish this with phpmyadmin? |
UPDATE user_subscriptions SET subscription_type="regular"; |
Describe the bug
Error when uploading attachments or files.
To Reproduce
Steps to reproduce the behavior:
Logs
Additional context
In its current state the docker compose file doesn't account for setting a files url at all so I changed
FILES_SERVER_URL: 'http://localhost:${EXPOSED_FILES_PORT}'
to
FILES_SERVER_URL: '${FILES_SERVER_URL}'
Then added
FILES_SERVER_URL=https://files-notes.REDACTED.com
to the .env file.
This resulted with the correct domain showing up in the network tab of developer tools:
{"filesServerUrl":"https://files-notes.REDACTED.com"}
The text was updated successfully, but these errors were encountered: