PatWie / excalidraw-complete

Effortlessly self-host Excalidraw with a single Go binary. Supports multiple storage options and real-time collaboration.
16 stars 4 forks source link

Error on share / collboration #4

Closed ar090 closed 3 weeks ago

ar090 commented 3 weeks ago

Thanks for putting this together! Love the idea of self hosting with the binary makes things incredibly simple. I am getting this error trying to export to file:

image

Additionally, collaboration button is giving something similar in the console

image

I'm likely missing some configuration setup somewhere. Using 0.0.2 for linux -> excalidraw-complete_Linux_x86_64.tar.gz I tried without any env variables and also with the file storage ones from the README.

Last question - for the AWS bucket storage, is this live? Guessing the go lib will look for the standard AWS env variables for secret / access keys?

Thanks again!

PatWie commented 3 weeks ago

I am currently on travel. Will have a look at that error when back. That key is the ULID key the implemented API backend returns (Are you using localhost 3000? Is the http response a 200?)

But yes, all storage options are tested and are working. It does read the default AWS profile credentials

ar090 commented 3 weeks ago

No worries at all appreciate the response. Whats interesting is I dont see any calls to an API? At least not via XHR. Here is what is loaded when i hit :3002 - all 200s

image

I am hosting this on an EC2 instance that I just left wide open to test this. The binary is unpacked and run with: sudo STORAGE_TYPE=filesystem LOCAL_STORAGE_PATH="/var/www/excalidraw" ./excalidraw-complete

The page loads fine and I can draw. plenty of logs coming through which are all 200s and appear to be all assets. I would say its as if there is no API running but also I don't see any calls coming from the frontend. FWIW this is all I see when I initially run the above command:

image

Its just when going to share or collaborate that I throw the errors in my original post.

PatWie commented 3 weeks ago

The frontend UI currently has URLs hard-coded to localhost:3002, which restricts its functionality when deployed on a different domain or IP address. As a result, simply moving the UI to an EC2 instance without modifying the build will prevent the server from receiving traffic. The releases are primarily designed for local testing and are not immediately suitable for broader deployment.

One potential workaround could be for the static file server to dynamically rewrite the URLs on the fly.

For the time being, you will need to adjust the URLs to match your specific setup by applying a git patch to the domain/URL, then rebuild the UI along with the necessary updates to the README and Go source files.

I can confirm that this setup works on EC2; I currently run it under a custom domain using AWS CloudFront, ALB, and Fargate.

ar090 commented 3 weeks ago

@PatWie this is exactly what I am trying to accomplish. Super helpful thank you! I will take the git patch route.

ar090 commented 3 weeks ago

That was definitely going to be a problem but not my exact problem still. I confirmed my patches worked by trying the API feature. Separate issue but your patch has an extra trailing /

image

results in api//v1

I noticed on the hosted excalidraw.com only after you click export to link is a post request fired. This error that I initially posted about is triggered before that post goes anywhere. So I'm back to trying to figure out when/how this key gets into state. My network tab vs production looks the same 🤔

If you are curious, here is my current deployment -> http://54.92.185.240:3002/

ar090 commented 3 weeks ago

I figured this out If anyone hits a similar snag its coming from this line: https://github.com/excalidraw/excalidraw/blob/a04676d4234e9f7d33500307b6a0481387820f3a/packages/excalidraw/data/encryption.ts#L16

TLDR Wont work unless you are on HTTPS