Skip to content
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

Cannot create memo with image attachment in 1.6 / memos 22.2 #186

Closed
raisinbear opened this issue Jun 17, 2024 · 16 comments
Closed

Cannot create memo with image attachment in 1.6 / memos 22.2 #186

raisinbear opened this issue Jun 17, 2024 · 16 comments

Comments

@raisinbear
Copy link

Hi,

first off, thank you so much for the great work you are doing with this app!
I just tried the latest version of MoeMemos (1.6 iOS) in conjunction with Memos 22.2. During testing, I found that if I create a memo with an image attachment and press the send button at the top, a grey banner flashes up briefly in the center of the screen, showing something with "unexpected" and then vanishes. A memo is then created, but without the attachment and the editor doesn't close, so I only noticed afterwards that I created like 8 memos without image.
On the memos side, everything looks good. The image resource is created, no errors whatsoever.

@Just-blue
Copy link

With the same problem, I used Android beta and Memos22.2

@netdog2019
Copy link

With the same problem, I used IOS and Memos22.2

@mudkipme
Copy link
Owner

I'm unable to reproduce this issue, could you provide the server log when you upload the image and save the memo?

And I'd like to know whether the attachment is successfully uploaded (in Resources page).

@mudkipme mudkipme added the question Further information is requested label Jun 17, 2024
@Just-blue
Copy link

I performed the following operations:
I created a new memo and uploaded an image. When I clicked to save, the situation mentioned above occurred; I returned and opened this memo again, re-uploaded the image, and at this point, a pop-up box displayed: invalid memo -id:invalid request "612"'.

Meanwhile, the images were actually all successfully uploaded in 'Resources'. I checked the database table 'resource', and the value of the 'memo_id' column for these data entries are all NULL.

Below are the log entries from the memo server:

2024/06/18 06:30:08 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/18 06:30:08 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:09 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:09 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:09 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:09 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:15 INFO OK method=/memos.api.v1.ResourceService/CreateResource
2024/06/18 06:30:16 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/18 06:30:17 INFO OK method=/memos.api.v1.MemoService/CreateMemo
2024/06/18 06:30:23 INFO OK method=/memos.api.v1.MemoService/CreateMemo
2024/06/18 06:30:25 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/18 06:30:25 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:25 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:25 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:26 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:28 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:28 INFO OK method=/memos.api.v1.UserService/GetUser
2024/06/18 06:30:28 INFO OK method=/memos.api.v1.UserService/GetUser
2024/06/18 06:30:29 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:29 INFO OK method=/memos.api.v1.UserService/GetUser
2024/06/18 06:30:32 INFO OK method=/memos.api.v1.ResourceService/ListResources
2024/06/18 06:30:32 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/18 06:30:36 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/18 06:30:41 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:42 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:42 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:42 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/18 06:30:49 ERROR unknown error method=/memos.api.v1.ResourceService/CreateResource error="rpc error: code = InvalidArgument desc = invalid memo id: invalid request \"612\""
2024/06/18 06:30:55 ERROR unknown error method=/memos.api.v1.ResourceService/CreateResource error="rpc error: code = InvalidArgument desc = invalid memo id: invalid request \"612\""
2024/06/18 06:31:00 ERROR unknown error method=/memos.api.v1.ResourceService/CreateResource error="rpc error: code = InvalidArgument desc = invalid memo id: invalid request \"612\""
2024/06/18 06:31:10 INFO OK method=/memos.api.v1.WorkspaceService/GetWorkspaceProfile
2024/06/18 06:31:10 INFO OK method=/memos.api.v1.AuthService/GetAuthStatus
2024/06/18 06:31:10 INFO OK method=/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting
2024/06/18 06:31:10 INFO OK method=/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting
2024/06/18 06:31:10 INFO OK method=/memos.api.v1.UserService/GetUserSetting
2024/06/18 06:31:11 INFO OK method=/memos.api.v1.InboxService/ListInboxes
2024/06/18 06:31:11 INFO OK method=/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting
2024/06/18 06:31:11 INFO OK method=/memos.api.v1.UserService/ListUserAccessTokens
2024/06/18 06:31:11 INFO OK method=/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting
2024/06/18 06:31:11 INFO OK method=/memos.api.v1.UserService/GetUserAvatarBinary

@mudkipme
Copy link
Owner

This is weird. The API request to CreateResource shouldn't contain the Memo field, and I'll upload a TestFlight build to ensure this field is null anyway.

Can you see any logs about method=/memos.api.v1.MemoService/SetMemoResources when you tap the save button?

@Just-blue
Copy link

I repeated the above operations, and after uploading the image, I deleted it. every time I click to save, there is only a CreateMemo log entry, and there are no other logs output.
Below are all the log entries from the memo server:

2024/06/19 07:47:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:44 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:44 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:44 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:44 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:48 INFO OK method=/memos.api.v1.MemoService/CreateMemo
2024/06/19 07:47:51 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/19 07:47:51 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/19 07:47:56 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:56 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:57 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:57 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:58 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:58 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:59 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:59 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:59 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:47:59 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:09 INFO OK method=/memos.api.v1.ResourceService/CreateResource
2024/06/19 07:48:09 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/19 07:48:24 INFO OK method=/memos.api.v1.MemoService/CreateMemo
2024/06/19 07:48:31 INFO OK method=/memos.api.v1.ResourceService/DeleteResource
2024/06/19 07:48:34 INFO OK method=/memos.api.v1.MemoService/CreateMemo
2024/06/19 07:48:35 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/19 07:48:36 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:36 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:38 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/19 07:48:38 ERROR: Failed to write response: write tcp 10.0.3.11:5230->10.0.3.12:56122: write: connection reset by peer
2024/06/19 07:48:38 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/19 07:48:38 ERROR: Failed to write response: write tcp 10.0.3.11:5230->10.0.3.12:56120: write: connection reset by peer
2024/06/19 07:48:42 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:42 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:42 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:43 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:44 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:45 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:58 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:48:59 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:49:00 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:49:00 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:49:00 INFO OK method=/memos.api.v1.MemoService/ListMemos
2024/06/19 07:49:10 ERROR unknown error method=/memos.api.v1.ResourceService/CreateResource error="rpc error: code = InvalidArgument desc = invalid memo id: invalid request \"615\""
2024/06/19 07:49:32 INFO OK method=/memos.api.v1.AuthService/GetAuthStatus
2024/06/19 07:49:32 INFO OK method=/memos.api.v1.UserService/GetUserSetting
2024/06/19 07:49:40 ERROR unknown error method=/memos.api.v1.ResourceService/CreateResource error="rpc error: code = InvalidArgument desc = invalid memo id: invalid request \"615\""
2024/06/19 07:49:52 INFO OK method=/memos.api.v1.AuthService/GetAuthStatus
2024/06/19 07:49:52 INFO OK method=/memos.api.v1.UserService/GetUserSetting
2024/06/19 07:49:56 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/19 07:49:57 INFO OK method=/memos.api.v1.MemoService/ListMemos

@mudkipme
Copy link
Owner

Thanks for the information. Please try the latest build on TestFlight (1.6.1) and check whether the issue is fixed: https://testflight.apple.com/join/YVHheZ50

@raisinbear
Copy link
Author

raisinbear commented Jun 20, 2024

Extremely sorry for not responding earlier. I somehow managed to get all my git notification mails moved to spam.
Anyhow, I just tried the test flight app and sadly the issue still persists.

The server doesn't log much, I'm afraid:

2024/06/20 10:30:31 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/20 10:30:41 INFO OK method=/memos.api.v1.ResourceService/CreateResource
2024/06/20 10:30:41 INFO OK method=/memos.api.v1.ResourceService/GetResourceBinary
2024/06/20 10:30:46 INFO OK method=/memos.api.v1.MemoService/CreateMemo
2024/06/20 10:30:46 INFO OK method=/memos.api.v1.MemoService/ListMemoTags
2024/06/20 10:30:48 INFO OK method=/memos.api.v1.MemoService/ListMemoTags

This is all that happens from the moment I create a new memo, write some random text, attach an image, and try to post it.
EDIT: The image does not show up under the resources later on!
EDIT2: All I can see in the app when the posting fails is:

IMG_2024-06-20T12-42-39

@raisinbear
Copy link
Author

On a sidenote, I'm using SQLite backend and in this (testflight) version of MoeMemos am forced to use access token since user/password authentication fails with the following server logs:

2024/06/20 10:28:08 INFO OK method=/memos.api.v1.WorkspaceService/GetWorkspaceProfile
2024/06/20 10:28:09 INFO OK method=/memos.api.v1.AuthService/SignIn
2024/06/20 10:28:09 INFO client error method=/memos.api.v1.AuthService/GetAuthStatus error="rpc error: code = Unauthenticated desc = user not found"

@mudkipme
Copy link
Owner

On a sidenote, I'm using SQLite backend and in this (testflight) version of MoeMemos am forced to use access token since user/password authentication fails with the following server logs:

2024/06/20 10:28:08 INFO OK method=/memos.api.v1.WorkspaceService/GetWorkspaceProfile
2024/06/20 10:28:09 INFO OK method=/memos.api.v1.AuthService/SignIn
2024/06/20 10:28:09 INFO client error method=/memos.api.v1.AuthService/GetAuthStatus error="rpc error: code = Unauthenticated desc = user not found"

I've submit another build to support some proxy server configuration.
Do you use any reverse proxy for your Memos instance, if so will the problem be gone if you are connecting directly to Memos?

@raisinbear
Copy link
Author

On a sidenote, I'm using SQLite backend and in this (testflight) version of MoeMemos am forced to use access token since user/password authentication fails with the following server logs:

2024/06/20 10:28:08 INFO OK method=/memos.api.v1.WorkspaceService/GetWorkspaceProfile
2024/06/20 10:28:09 INFO OK method=/memos.api.v1.AuthService/SignIn
2024/06/20 10:28:09 INFO client error method=/memos.api.v1.AuthService/GetAuthStatus error="rpc error: code = Unauthenticated desc = user not found"

I've submit another build to support some proxy server configuration. Do you use any reverse proxy for your Memos instance, if so will the problem be gone if you are connecting directly to Memos?

Right, I’m using nginx as a reverse proxy. Haven’t touched the config in a long time, though and with the current iOS version and memos 0.20.1 no issues whatsoever. I’ll try the new build asap and report back! Thanks for the quick response!

@raisinbear
Copy link
Author

On a sidenote, I'm using SQLite backend and in this (testflight) version of MoeMemos am forced to use access token since user/password authentication fails with the following server logs:

2024/06/20 10:28:08 INFO OK method=/memos.api.v1.WorkspaceService/GetWorkspaceProfile
2024/06/20 10:28:09 INFO OK method=/memos.api.v1.AuthService/SignIn
2024/06/20 10:28:09 INFO client error method=/memos.api.v1.AuthService/GetAuthStatus error="rpc error: code = Unauthenticated desc = user not found"

I've submit another build to support some proxy server configuration. Do you use any reverse proxy for your Memos instance, if so will the problem be gone if you are connecting directly to Memos?

The new version doesn't really do anything different for me, but good catch, it is the proxy. When connecting directly (over http) to the instance, password login and image attachments work. Otherwise the following is logged in the nginx error log:

2024/06/21 08:53:44 [error] 1868335#1868335: *684 upstream prematurely closed connection while reading response header from upstream, client: [redacted], server: [redacted], request: "PATCH /api/v1/memos/359/resources HTTP/2.0", upstream: "http://127.0.0.1:5230/api/v1/memos/359/resources", host: 

Also there are a lot of these in the nginx access log:

[redacted] - - [21/Jun/2024:08:52:12 +0200] "GET /api/v1/memos/-/tags HTTP/2.0" 400 162 "-" "MoeMemos/49 CFNetwork/1496.0.7 Darwin/23.5.0"
[redacted] - - [21/Jun/2024:08:53:02 +0200] "POST /api/v1/auth/status HTTP/2.0" 401 53 "-" "MoeMemos/49 CFNetwork/1496.0.7 Darwin/23.5.0"

I guess these could explain why I have to manually reload the memos overview with the new MoeMemos version to see any recent memos. Also maybe why tags do not show up properly.

The following would be my nginx config. Like I said before, I never touched it since setting up memos roughly 1 1/2 years ago. Pretty standard config + some increased timeouts. Also have been using MoeMemos pretty much from the beginning.

location / {
            proxy_pass         http://127.0.0.1:5230;
            proxy_set_header   X-Forwarded-Host $host;
            proxy_set_header   Host $http_host;
            proxy_redirect     off;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;
            client_max_body_size 150m;

            proxy_send_timeout 86400s;
            proxy_read_timeout 86400s;

            client_body_timeout 120s;
            keepalive_timeout 150s;
        }

@mudkipme
Copy link
Owner

Thanks for the information. So it is the PATCH request causing this and it should be the same reason with mudkipme/MoeMemosAndroid#187 (comment). This will be fixed by usememos/memos#3600 when it got merged.

For the login error, I guess it's a separate issue (related to Set-Cookie response header) and I'll submit another pull request to Memos soon.

@raisinbear
Copy link
Author

Thanks for the information. So it is the PATCH request causing this and it should be the same reason with mudkipme/MoeMemosAndroid#187 (comment). This will be fixed by usememos/memos#3600 when it got merged.

For the login error, I guess it's a separate issue (related to Set-Cookie response header) and I'll submit another pull request to Memos soon.

Awesome, thanks a lot! 🤩

@mudkipme
Copy link
Owner

The fix is merged, please try upgrading the server to neosmemo/memos:latest or 0.22.3 docker tag.

@mudkipme mudkipme added server-side and removed question Further information is requested labels Jun 21, 2024
@raisinbear
Copy link
Author

The fix is merged, please try upgrading the server to neosmemo/memos:latest or 0.22.3 docker tag.

Can confirm this works flawlessly for attaching images! Thanks so much for the quick fix!

FYI, login appears to still not work with username/password and tags aren't listed initially. Only when I manually enter them (existing ones), in a new memo do they appear in the list. But that's a minor problem, at least in my case.

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

When branches are created from issues, their pull requests are automatically linked.

4 participants