MoneyPrinter icon indicating copy to clipboard operation
MoneyPrinter copied to clipboard

receiving CORS error [BUG]

Open asimiqbl3 opened this issue 1 year ago • 5 comments

image

I used your described method of using docker image here https://github.com/FujiwaraChoki/MoneyPrinter/issues/140. and I can see containers are running without any issue.

image here's the backend log

image

Environment: Docker version 24.0.4, build 3713ee1

Running on linux host: Linux XXXXX 4.18.0-477.15.1.el8_8.x86_64 #1 SMP Fri Jun 2 08:27:19 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux

This is a node on same network I'm accessing it from a laptop with 192.168.1.202 IP . the Linux has IP 192.168.1.21 . do you think it needs to be accessed from same host i.e., 192.168.1.21 GUI ?

Any kind of help is highly appreciated.

Thanks

asimiqbl3 avatar Feb 10 '24 09:02 asimiqbl3

@iStorry

FujiwaraChoki avatar Feb 10 '24 10:02 FujiwaraChoki

Try to start your browser with CORS disabled. For me was "C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=~\chromeTemp" . I think there was an extension for firefox that does the same.

vo1d-null avatar Feb 10 '24 12:02 vo1d-null

What fixed this for me is that the frontend is fixed on localhost:8080 -> has to be changed to your backend server IP address/hostname. sed -i 's/localhost/<ipaddress>/' index.html

itbane avatar Feb 10 '24 13:02 itbane

Is there any reason why the frontend is separate? Couldn't it be served from the same server using Flask's built-in render_template method?

Chiroyce1 avatar Feb 10 '24 16:02 Chiroyce1

What fixed this for me is that the frontend is fixed on localhost:8080 -> has to be changed to your backend server IP address/hostname. sed -i 's/localhost/<ipaddress>/' index.html

This solution worked for me. it starts generating the video but I'm getting a different error message now. I think it's related to some font not properly configured in imagemagick configure file. I'm trying to figure that out now.

[+] Creating subtitles using AssemblyAI INFO:httpx:HTTP Request: POST https://api.assemblyai.com/v2/upload "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.assemblyai.com/v2/transcript "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: GET https://api.assemblyai.com/v2/transcript/d4b3b6c2-3b05-4a7b-a21a-17f136dd16ec "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: GET https://api.assemblyai.com/v2/transcript/d4b3b6c2-3b05-4a7b-a21a-17f136dd16ec "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: GET https://api.assemblyai.com/v2/transcript/d4b3b6c2-3b05-4a7b-a21a-17f136dd16ec/srt "HTTP/1.1 200 OK" [+] Subtitles generated. ['../temp/67bc6bd5-b028-450c-bb02-d8e33ff02f61.mp4', '../temp/17c3a328-3c4f-4f09-a15c-ee6e8f319ada.mp4', '../temp/e4f73a7d-346c-43a4-9455-94455eb2cfd7.mp4', '../temp/f5a0d1ff-f31a-46a3-8193-cb7980447468.mp4', '../temp/0c94efcd-0298-40d2-94d4-120c21366c0b.mp4', '../temp/758f8d23-50de-4912-8fc3-e073779cf287.mp4', '../temp/fab9717b-40cd-46dc-ada4-526cbf0c295d.mp4'] [+] Combining videos... [+] Each clip will be maximum 1.6714285714285713 seconds long. Moviepy - Building video ../temp/354587fc-8485-4fe8-9185-94cc8a6ba220.mp4. Moviepy - Writing video ../temp/354587fc-8485-4fe8-9185-94cc8a6ba220.mp4

Moviepy - Done ! Moviepy - video ready ../temp/354587fc-8485-4fe8-9185-94cc8a6ba220.mp4 [-] Error generating final video: MoviePy Error: creation of None failed because of the following error:

magick: delegate library support not built-in '../fonts/bold_font.ttf' (Freetype) @ warning/annotate.c/RenderFreetype/1986. magick: no decode delegate for this image format `' @ error/constitute.c/ReadImage/737. magick: no images for write '-write' 'PNG32:/tmp/tmpyn94i4pi.png' at CLI arg 18 @ error/operation.c/CLINoImageOperator/4919. .

.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect [+] Video generated: None!

I've the imagemagick installed already but I think it's not able to detect font it needs.

root@62c42c687ef8:/home/MoneyPrinter/fonts# convert --version Version: ImageMagick 7.1.0-31 Q16-HDRI x86_64 2a782ebe0:20220423 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP(4.5) Delegates (built-in): Compiler: gcc (11.4)

Thanks

asimiqbl3 avatar Feb 10 '24 23:02 asimiqbl3

Is there any reason why the frontend is separate? Couldn't it be served from the same server using Flask's built-in render_template method?

I've docker running on a separate instance with some beefy specs cpu. I'd like to run it on that. It's a headless so wondering if that's possible.

asimiqbl3 avatar Feb 11 '24 02:02 asimiqbl3

Well. I found the solution for my problem. Sharing it for other people who may be experiencing similar issue. I needed to compile imagemagick with PNG support. There is a project on github that handels all the steps for us, it's ubuntu/debian only atm.

https://github.com/SoftCreatR/imei/

after installing it took around 20-25 mins to complete the imagemagick install and fixed everything for me. so far so good.

Thanks

asimiqbl3 avatar Feb 11 '24 06:02 asimiqbl3

Is there any reason why the frontend is separate? Couldn't it be served from the same server using Flask's built-in render_template method?

I've docker running on a separate instance with some beefy specs cpu. I'd like to run it on that. It's a headless so wondering if that's possible.

It is. just make all changes necessary (e.g. the sed command above) in the Dockerfile (or fork the project and add our specific destinations)

itbane avatar Feb 11 '24 12:02 itbane