# Upgrade Phoenix 1.7 to Phoenix 1.8

An agent moves a LiveView app to Phoenix 1.8.16 on OTP 25 and Elixir 1.15; the prod compile passes, and test failures go from 9 to 8.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-framework-major/phoenix/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads `mix.exs`, `mix.lock`, the `Dockerfile` and `lib/live_beats_web.ex` first. The builder image was `hexpm/elixir:1.14.0-erlang-24.0.1`, and Phoenix 1.8's own `mix.exs` needs Elixir `~> 1.15`, so the builder image moves to Elixir 1.15.8 on OTP 25.3.2.21, the versions it builds with, and mix.exs's floor to `~> 1.15`.

`mix deps.update phoenix` failed because the git-pinned `phoenix_live_view` allows only Phoenix 1.6 or 1.7, so LiveView moved too, plus `phoenix_pubsub` and `plug_crypto`. Of the changelog items, only the deprecated `namespace: LiveBeatsWeb` option applied. There is no `put_layout` call or endpoint `config` variable; a request to `/` showed the new `content-security-policy` header with nothing in the app needing a frame.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade this app from Phoenix 1.7 to Phoenix 1.8 following the official upgrade notes in the Phoenix v1.8 CHANGELOG step by step. Phoenix 1.8 requires Erlang/OTP 25 or later, so update the Dockerfile's builder and runner images and use the same OTP and Elixir in your own build. Change the phoenix requirement in mix.exs and run mix deps.update phoenix, moving only the dependencies Mix requires. Handle each deprecation and potential breaking change that applies to this code (use Phoenix.Controller options, put_layout, the endpoint config variable, put_secure_browser_headers). Start Postgres as config/test.exs expects. After each step run mix compile --warnings-as-errors and mix test, and fix what breaks. Open a pull request that lists each change with the changelog item it answers, and anything you left for a person to decide.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on fly-apps/live_beats at ac97804: 4 files changed, 10 insertions(+), 11 deletions(-) in `Dockerfile`, `lib/live_beats_web.ex`, `mix.exs` and `mix.lock`. After the change, `MIX_ENV=prod mix compile --warnings-as-errors` ended `Generated live_beats app` with exit 0 (the run did not take this check before the change). In the test environment the same compile exits 1 before and after, on one warning in `test/support/presence/presence_mock.ex:25`, and `mix test` went from `34 tests, 9 failures` to `34 tests, 8 failures`; the run calls the failures pre-existing and the dropped one order-dependent. Docker was not installed, so the image was never built. No pull request was opened.

For the reviewer: whether to pin a released LiveView instead of the default-branch commit `cff4e32`, and whether to fix the pre-existing test failures separately.

## Run it on every Monday until the upgrade lands

An automation with a `schedule` trigger, `cron` `0 9 * * 1` and this prompt starts the upgrade on a Monday morning, with the Dockerfile, lock and test results ready. Switch it off once the upgrade merges, since this is a one-time move rather than a recurring bump.

## Why run it on Rush?

Of the four changelog items the request names, only the deprecated `:namespace` option needed a change. Phoenix 1.8 raised the Elixir floor the old builder image could not meet, and the git-pinned LiveView would not resolve. The run also kept out a `cowlib` 2.21 that Mix pulled in but that does not compile on OTP 25.

## Frequently asked questions

### What did the run patch that is not in the diff?

It patched the untracked `deps/bumblebee` so the Whisper model download follows Hugging Face's relative redirect, without which the app does not start under test. It also set placeholder `LIVE_BEATS_GITHUB_*` values and ran Postgres 15 as `config/test.exs` expects.

### What are the eight remaining test failures?

Postgrex returning INET for `server_ip`, which the schema types as `:string`, and a LiveView stream-container error on the profile page. Both appear on the untouched clone too.

## More Phoenix jobs

- [Upgrade Hex Dependencies in a Phoenix App](https://getrush.ai/run/upgrade-hex-dependencies/phoenix/)
- [Write ExUnit Tests for a Phoenix App](https://getrush.ai/run/write-exunit-tests/phoenix/)
- [Add Rate Limiting to a Phoenix API from a Linear Issue](https://getrush.ai/run/add-api-rate-limit/phoenix/)

## The same job on other stacks

- [Upgrade React 18 to React 19](https://getrush.ai/run/upgrade-framework-major/react-18/)
- [Upgrade Spring Boot 2.6 to Spring Boot 4](https://getrush.ai/run/upgrade-framework-major/spring-boot-2/)
- [Upgrade Laravel 11 to Laravel 13](https://getrush.ai/run/upgrade-framework-major/laravel/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
