UnicodeError 'idna' encoding when working with Heroku, Redis and Flask

158
February 15, 2021, at 02:20 AM

I have a Flask REST API hosted on Heroku with a Heroku-Redis server.

When code that tries to access the Redis server is executed I get the following error.

UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)

The code that seems to cause this error is,

revoked_store.set(access_jti, 'false', ACCESS_EXPIRES * 1.2)
revoked_store.set(refresh_jti, 'false', REFRESH_EXPIRES * 1.2)

The connection is set here:

revoked_store = redis.StrictRedis(host=os.environ.get('REDIS_URL'), port=6379, db=0, decode_responses=True)

From looking at various other posts I think this error is caused by the Redis URL being too long (>64 characters). See here.

I am not sure how to fix this effort so any help would be appreciated.

If you require more information, please let me know.

Thank you.

READ ALSO
Why is this happening? I'm getting correct display in console output and right amount of rows in UI but I'm getting no outputs

Why is this happening? I'm getting correct display in console output and right amount of rows in UI but I'm getting no outputs

So I have this problem with displaying phone numbers for userConsole output is displaying numbers, and my user interface is displaying the right amount of rows but not numbers themselves

143
Find similar news on SQL based on similar tags

Find similar news on SQL based on similar tags

I have a list of news from a few newspapers(Getting them from a RSS feed)Let's say every newspaper returns a list of news with tags

134
Update data only if user change anything in laravel

Update data only if user change anything in laravel

Update data only if the user changes anything otherwise return a message that nothing to updateAfter click the edit button, if the user hits update button without change anything then return message nothing to update

137
How to make webpack ignore a require to a mising file in a npm module?

How to make webpack ignore a require to a mising file in a npm module?

When bundling my project with webpack, I encountered an error message indicating that anode file required in one of my npm package does not exist

122