fix(ci): install langflow with [postgresql] extra in migration-test - #234
Merged
Conversation
The refactor that switched from Docker pulls to `uv pip install langflow` dropped the PostgreSQL driver. The official Docker image bundles psycopg2-binary, but the PyPI package declares psycopg2 only under the `postgresql` extra (`sqlalchemy[postgresql-psycopg2binary]`). Without the extra, Langflow crashes on startup with `ModuleNotFoundError: No module named 'psycopg2'` inside `check_postgresql_version_sync` for any `postgresql://` database URL. This behavior is identical in 1.9.2 and 1.9.3 — confirmed empirically via isolated Podman containers — so it is not a Langflow regression, just the documented packaging contract. Fix: add `[postgresql]` to both install steps (latest and nightly). Validated locally with `uv pip install "langflow[postgresql]"` against a fresh Postgres 16 container: Langflow 1.9.3 boots cleanly and serves the API. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the migration-test GitHub Actions workflow to install Langflow with the postgresql extra so the workflow can start Langflow successfully when LANGFLOW_DATABASE_URL uses the postgresql:// scheme (restoring parity with the official Docker image, which includes Postgres driver deps).
Changes:
- Install
langflow[postgresql]for the “latest” phase. - Install
langflow[postgresql]==$NIGHTLY_VERSIONfor the “nightly” phase.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
lice-reis
added a commit
that referenced
this pull request
May 18, 2026
…244) * fix(ci): expose OPENAI_API_KEY to Langflow process for env-based credential auto-import The setup_latest.py helper creates the OPENAI_API_KEY Global Variable via POST /api/v1/variables/ AFTER Langflow is already running. The Simple Agent starter project, however, resolves its credential binding at startup — so the variable created post-startup is not picked up, and flow execution fails with "Missing credentials". Langflow has built-in support for promoting OS environment variables to Credential-typed Global Variables on startup. `OPENAI_API_KEY` is in the default auto-import list, so simply exposing it as an env var on the Start step makes the variable available at the right time, encrypted with LANGFLOW_SECRET_KEY in the DB just like any UI-created credential. Reference: https://docs.langflow.org/configuration-global-variables ("Langflow automatically detects standard keys like OPENAI_API_KEY from constants.py without requiring explicit declaration in LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT.") The redundant POST /api/v1/variables/ call in setup_latest.py is left in place — it's now a no-op or a warning, but it doesn't fail the run. Can be cleaned up in a follow-up. Closes the failure mode exposed by run 26047300330 (which itself was unblocked by the [postgresql]-extra fix in #234). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(ci): fail fast when OPENAI_API_KEY secret is missing Address Copilot review feedback on #244. When the OPENAI_API_KEY repo secret is not configured, `\${{ secrets.OPENAI_API_KEY }}` resolves to an empty string rather than being unset. Langflow's env-based credential auto-import skips empty values, so the workflow only fails 5+ minutes later at the flow-execution step with a misleading "Missing credentials" error. Guard with an early step that aborts immediately with a clear message if the secret is empty, sparing the install/migration time on a known-bad configuration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
migration-test.ymlstarted failing on theWait for Langflow lateststep after PR #230 replaced the Docker-based setup withuv pip install langflow.psycopg2-binary, but the PyPI package declarespsycopg2only under thepostgresqlextra (sqlalchemy[postgresql-psycopg2binary]). Without the extra, Langflow crashes on startup withModuleNotFoundError: No module named 'psycopg2'insidecheck_postgresql_version_syncwheneverLANGFLOW_DATABASE_URLstarts withpostgresql://.[postgresql]to both install steps (latest and nightly). No code or migration logic changed.Investigation findings (for the record)
UniqueViolation).ModuleNotFoundErrorat the same line. The functioncheck_postgresql_version_syncis present and identical in both versions. PyPI metadata for psycopg has been identical since 1.9.0.docker pull langflowai/langflow:latest, which haspsycopg2-binarybaked in.Test plan
python:3.12-slim:pip install uv→uv venv .venv→uv pip install "langflow[postgresql]"→uv run langflow runimport psycopg2succeeds (psycopg2 2.9.12)/api/v1/versionand loaded 32 starter projects against a fresh Postgres 16migration-test.ymlafter merge — should now pass the full latest → nightly flow🤖 Generated with Claude Code