Repository navigation
feat(amplify): branch previews sign in on dev as remoteit_portal, deployed only from repo branches - #1283
Conversation
…eir exact callbacks registered while open
…st; leaner reconcile script and 6-hourly backstop
…s a missing key and keeps token error status
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
…ed by AMPLIFY_PREVIEW; drop the per-PR callback workflow
|
@codex review Generated by Claude Code |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
Amplify builds a preview at
https://pr-<N>.d20k671nqqv4kl.amplifyapp.comfor every PR intomain/release, and none of them can sign in:remoteit_desktoponlogin.remote.it./authorizeanswers400 invalid_request "redirect_uri not registered".Amplify's PR previews also build PRs from forks. #1179 (from
eastagiletracker/desktop) was deployed topr-1179.d20k671nqqv4kl.amplifyapp.com. So while PR previews are on, no callback covering the preview domain is safe to register.Approach
The first version registered each open same-repo PR's exact callbacks from a GitHub workflow that held a dev
clients.writekey (remoteit/authentication#58). After review, this replaces it:feat/**andfix/**branches pushed to this repo, deploys each to its own*.d20k671nqqv4kl.amplifyapp.comaddress, and drops it when the branch is deleted. Only someone who can push to this repo gets a deploy. Forks can't.remoteit_portalcan carry a wildcard:https://*.d20k671nqqv4kl.amplifyapp.com/authCallbackand/signoutCallback. There's no key in GitHub and no per-PR registration.Changes
amplify.ymlis the console build spec, now in the repo, with one addition. WhenAMPLIFY_PREVIEW=true, it sourcesscripts/amplify-preview-env.sh. Only autodetected branches have that variable, from the app's auto-branch config. The script:VITE_GRAPHQL_API,VITE_WEBSOCKET_URL, theVITE_OAUTH_*resources);VITE_OAUTH_ISSUER=https://login.dev.remote.itandVITE_OAUTH_CLIENT_ID=remoteit_portal;VITE_AGENT_URL, because a pinned build otherwise calls/agent, which only the vite dev server proxies.STAGES.devinconstants.tssupplies the rest. Every other branch builds exactly as it does today.Removed the Preview callbacks workflow and its script.
readme: how previews build and sign in, and why PR previews must stay off. RELEASE.md: the build spec now lives in the repo.
Verified
main.npmand the legacy app-level variables set:AMPLIFY_PREVIEW=truegivesremoteit_portalandlogin.dev.remote.it, with the GraphQL pin removed.AWS_PULL_REQUEST_IDset.scripts/amplify-preview-env.shchanged. The earlier check of what it resolves to through Vite still applies:STAGE=dev, the cloud.dev GraphQL and websocket URLs, the dev agent and MCP.main.Not verified: a deployed preview signing in end to end. That needs the rollout.
Rollout
d20k671nqqv4kl, us-west-1). Turn PR previews off on every branch that has them (aws amplify list-branchesshows which), then turn on branch autodetection:pr-Nbranches in the app.remoteit_portal. This needs Permitteer to accept a wildcard. Close remoteit/authentication#58.feat/branch created from the newmain, check that it deploys and signs in on dev.Step 1 must come before step 4. Merging before step 1 is harmless.
Notes:
amplify.ymlonly once it contains it. After that, Amplify ignores console build-setting edits for that branch.Generated by Claude Code