langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
31.99k stars 3.94k forks source link

Railway install: No ability to create global variables #4186

Open MLorneSmith opened 3 days ago

MLorneSmith commented 3 days ago

Bug Description

After the one-click install of Langflow on Railway (latest version), I can't seem to create any global variables. Getting the following error: 'Error creating variable Fernet key must be 32 url-safe base64-encoded bytes'

Reproduction

  1. Install latest version of Langflow on railway
  2. Attempt to create a global variable

Expected behavior

I expect to be able to create a variable

Who can help?

No response

Operating System

Railway environment

Langflow Version

1.0.19

Python Version

None

Screenshot

No response

Flow File

No response

dosubot[bot] commented 3 days ago

Hey there, @MLorneSmith! I'm here to help you with any bugs, questions, or contributions you might have. Let's tackle this together!

I found a similar issue regarding the error message "Fernet key must be 32 url-safe base64-encoded bytes" when trying to create a global variable in Langflow version 1.0.19 on Railway. To resolve this error, ensure that the SECRET_KEY used in the get_fernet function is properly formatted. You can use the add_padding function to ensure the key is valid:

def add_padding(s):
    padding_needed = 4 - len(s) % 4
    return s + "=" * padding_needed

In the get_fernet function, use this add_padding function to ensure the SECRET_KEY is valid:

def get_fernet(settings_service=Depends(get_settings_service)):
    SECRET_KEY = settings_service.auth_settings.SECRET_KEY.get_secret_value()
    padded_secret_key = add_padding(SECRET_KEY)
    fernet = Fernet(padded_secret_key)
    return fernet

Make sure the SECRET_KEY is correctly set in your settings. If necessary, generate a new key using Fernet.generate_key() and update your settings with this new key [1].

To continue talking to Dosu, mention @dosu.