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

Cloudflare Storage: Link too long to be stored to resource.reference #4322

Open
chez14 opened this issue Jan 27, 2025 · 0 comments
Open

Cloudflare Storage: Link too long to be stored to resource.reference #4322

chez14 opened this issue Jan 27, 2025 · 0 comments
Labels
bug Something isn't working PR welcome Good for new contributor

Comments

@chez14
Copy link

chez14 commented Jan 27, 2025

Describe the bug

When setting up Memo to use Cloudflare R2, upon saving, it shows the following error on the screen:

Image

Here's the console log:

memos  | 2025/01/27 14:54:55 ERROR server error method=/memos.api.v1.ResourceService/CreateResource error="rpc error: code = Internal desc = failed to create resource: Error 1406 (22001): Data too long for column 'reference' at row 1"

Image

After digging around, I think i know the issue: the reference column in resource name is not sufficient to store signed URL from Clouadlare R2. The usual Cloudflare R2 URL uses the https://[bucket].[account-id].r2.cloudflarestorage.com. Here's R2 sample link:

https://bucket-name.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.r2.cloudflarestorage.com/assets/aaaaaaaaaaaaaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa%2Faaaaaaaa%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250123T110829Z&X-Amz-Expires=432000&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

It has 427 charactes while the column were set only to varchar(256). I think we can just create a new migration to update the column to be TEXT for mysql. Waht do you think? I kinda want to send a PR for this.

Steps to reproduce

  1. Install & Setup memo with the following info:
  • Install using Docker Compose
  • Use MariaDB.
  1. Use Cloudflare R2 for storage option, as described in the following documentations:
    https://www.usememos.com/docs/advanced-settings/cloudflare-r2
  2. Save the configurations
  3. Create a new Memo, and upload an image. The screen immediately shows error.

The version of Memos you're using

v0.23.0

Screenshots or additional context

No response

@chez14 chez14 added the bug Something isn't working label Jan 27, 2025
@johnnyjoygh johnnyjoygh added the PR welcome Good for new contributor label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR welcome Good for new contributor
Projects
None yet
Development

No branches or pull requests

2 participants