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

500 internal error using PaaS, working fine on local #584

Closed
fullfine909 opened this issue Oct 7, 2020 · 5 comments
Closed

500 internal error using PaaS, working fine on local #584

fullfine909 opened this issue Oct 7, 2020 · 5 comments
Labels

Comments

@fullfine909
Copy link

Hi!

I am developing a tool that takes songs of Youtube and creates a playlists in Spotify. I have run the application succesfully in local, but I get an error when I try it in Elastic Beanstalk, the PaaS of Amazon.

I am using a Flask server and the Spotipy python library. I think that the problem is related with the redirect_uri, but I have no idea of what I should do. I create two spotipy objects in my code. The first one, using Client Credentials Flow, works perfectly online. However, when I try to use another one with Authorization Code Flow, I get the error. I can even create it, but when I call to any function, even to search tracks, I get the 500 internal server error. I assume that the redirect_uri has to be the same url where the app is launched.

Thanks in advance!

@fullfine909 fullfine909 added the bug label Oct 7, 2020
@fullfine909
Copy link
Author

Not really. I think that now it works locally because it has the token in the cache. Do you know how can I force to delete it?

@stephanebruckert
Copy link
Member

stephanebruckert commented Oct 7, 2020

There should be a hidden file starting with .cache in your project folder. You can delete it using rm

@fullfine909
Copy link
Author

Okay, I've gotten it to work in a bit of a "dirty" way. Calling SpotifyOAuth () I pass the variable cache_path = '. Mycache' to it, then I upload it to aws and it works, but I think this is just a temporary solution. I attach the link so you can see the work:
http://ys5-env.eba-mjmi37yf.eu-west-1.elasticbeanstalk.com/
Example videos that work:
https://www.youtube.com/watch?v=5lthiQoQiRA&t=2953s&ab_channel=H%C3%96RBERLIN
https://www.youtube.com/watch?v=4utKO75DtBE&t=637s&ab_channel=BE-AT.TV
You can click the title and you will find a playlist with all the songs, you can click a song and the spotify link will open, you can move the mouse over the covers and it will be heard.

@stephanebruckert
Copy link
Member

I pass the variable cache_path = '. Mycache' to it, then I upload it to aws and it works, but I think this is just a temporary solution

I think you are right, it's not a good solution and could be improved.

What I've been doing in my own app is to persist new tokens into a DB and then read from that DB every time I need the token. See https://github.com/resident-archive/resident-archive/blob/a869b73f1f64538343be1604d43693b6165cc58a/functions/to-spotify/main.py#L129..L157

I'm going to close your issue as you found a temporary solution, and the improvement above can be discussed here #51

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

No branches or pull requests

2 participants