Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
3.01k stars 122 forks source link

Web does nothing when import "Extended Streaming History" #398

Closed kevinlf3 closed 4 months ago

kevinlf3 commented 4 months ago

Hi, I received my Extended Streaming History from Spotify, 8 JSON files.

Imagen de WhatsApp 2024-05-12 a las 19 56 55_12d44c19

But when I select the option to import the Extended History, 1 by 1 or the 8 files all together does nothing, there is a micro refresh but nothing happens, and a green letters told me "Everything looks fine for the import to work".

A few days ago I import the Account Data and everithing was great.

fa64ee6cf75d320eadc04fbda5c88948

Here is the error:

Sin título

What I'm doing wrong? Or what's the problem?

Thanks!

MIJmker commented 4 months ago

Hi Kevin,

CORS (Cross-Origin Resource-Sharing) is blocking the requests. Are the request send from one subdomain to another subdomain? I had the same issue with the API and frontend, so I had to add an environment variable to the docker-compose:

This allows both spotify.example.com and spotify-api.example.com to "communicate" in a sense. ofcourse replace those with your actual subdomains.

Hope this helps

RagingCactus commented 4 months ago

I'm pretty sure CORS is not the main issue here. Everything else in your installation works, right? You can log in and look at the data in the dashboard? In that case CORS is already configured correctly. It should work out of the box without additional configuration for most deployments.

I assume the root cause is the 413 "Payload Too Large" error. CORS might not work properly as the request is already blocked/dropped because the request exceeds the size limit. This in itself might be worth looking into, but I suspect this is not the root cause.

I think the current code in YourSpotify limits each individual file to 20 MB so it should work: https://github.com/Yooooomi/your_spotify/blob/7f7f8842ae667d5be385a58e957aa65e1cc10f72/apps/server/src/routes/importer.ts#L20-L26

Are you using any kind of reverse proxy or web server in front of YourSpotify that might restrict the file size further?

Yooooomi commented 4 months ago

Hello, are you using linuxserver image?

kevinlf3 commented 4 months ago

Hello, are you using linuxserver image?

No, i'm using your image:

image

Thank you!

Yooooomi commented 4 months ago

Your mongo does not seem well am I right?

kevinlf3 commented 4 months ago

Your mongo does not seem well am I right?

It's not upadated to the latest version, but does not interfere.

kevinlf3 commented 4 months ago

I tested to upload the file with only one song, the JSON file only weighs 1kb and upload succesfully.

I think there is a limitation of the file weight or the ammount of songs you can import.

I hope I can help you!

Yooooomi commented 4 months ago

If you're using nginx, there is a default limit that you have to override for the api reverse proxy.

kevinlf3 commented 4 months ago

If you're using nginx, there is a default limit that you have to override for the api reverse proxy.

Do you know how to do that?

Yooooomi commented 4 months ago

There is a parameter you can add to the location definition of your api: https://stackoverflow.com/a/37916740/5641146

kevinlf3 commented 4 months ago

There is a parameter you can add to the location definition of your api: https://stackoverflow.com/a/37916740/5641146

Thank you, It works!