Skip to content

Conversation

@WhoamiI00
Copy link

@WhoamiI00 WhoamiI00 commented Dec 6, 2025

Problem

After migrating a project from Cloud to a self-hosted instance, users were redirected to a non-existent URL (/console/project-{projectId}/settings/migrations) causing a 404 error.

Root Cause

  1. The region parameter was missing from the redirect URL on self-hosted instances (where region is undefined).
  2. The project object wasn't being correctly captured after creation.

Solution

  • Captured the newly created project in newlyCreatedProject.
  • Added a fallback targetProject.region ?? 'default' to matches the self-hosted URL pattern.

Related Issue

Closes #2183

Summary by CodeRabbit

  • Bug Fixes
    • Fixed migration wizard to properly handle newly created projects, ensuring correct navigation to the migrations page for both newly created and existing projects.

✏️ Tip: You can customize this high-level summary in your review settings.

@appwrite
Copy link

appwrite bot commented Dec 6, 2025

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Failed Failed Authorize Preview URL QR Code

Tip

GraphQL API works alongside REST and WebSocket protocols

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

Walkthrough

The change modifies the migration wizard component to introduce a new local variable newlyCreatedProject that tracks newly created projects. During the migration finish flow, the code now references either the newly created project or falls back to the currently selected project when constructing the migrations settings URL. When a new project is created via the "Next" action, the project is stored in this variable and its SDK instance is initialized. Navigation logic is updated to direct users to the appropriate project's migrations page, with the region defaulting to 'default' if not specified.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • New state variable logic: Review how newlyCreatedProject is initialized, populated during project creation, and used throughout the component to ensure proper null handling and state transitions
  • Conditional fallback pattern: Verify the newlyCreatedProject || currentSelectedProject fallback logic handles all execution paths correctly, particularly when both variables could be null or when switching between project contexts
  • Navigation URL construction: Confirm the migrations settings URL is correctly built with the appropriate project segment and that the region default behavior ('default') is applied consistently
  • Project SDK initialization: Ensure projectSdkInstance is properly initialized for the newly created project and that this doesn't introduce race conditions or state inconsistencies

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing a 404 redirect issue on self-hosted instances during migrations.
Linked Issues check ✅ Passed The code changes directly address all objectives from issue #2183: capturing the newly created project and adding region fallback ('default') for self-hosted URL construction.
Out of Scope Changes check ✅ Passed All changes in wizard.svelte are directly scoped to fixing the migration redirect issue; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f19450 and 2803000.

📒 Files selected for processing (1)
  • src/routes/(console)/(migration-wizard)/wizard.svelte (3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx,svelte}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,svelte}: Import reusable modules from the src/lib directory using the $lib alias
Use minimal comments in code; reserve comments for TODOs or complex logic explanations
Use $lib, $routes, and $themes aliases instead of relative paths for module imports

Files:

  • src/routes/(console)/(migration-wizard)/wizard.svelte
src/routes/**/*.svelte

📄 CodeRabbit inference engine (AGENTS.md)

Use SvelteKit file conventions: +page.svelte for components, +page.ts for data loaders, +layout.svelte for wrappers, +error.svelte for error handling, and dynamic route params in square brackets like [param]

Files:

  • src/routes/(console)/(migration-wizard)/wizard.svelte
**/*.{ts,tsx,js,jsx,svelte,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4 spaces for indentation, single quotes, 100 character line width, and no trailing commas per Prettier configuration

Files:

  • src/routes/(console)/(migration-wizard)/wizard.svelte
**/*.svelte

📄 CodeRabbit inference engine (AGENTS.md)

Use Svelte 5 + SvelteKit 2 syntax with TypeScript for component development

Files:

  • src/routes/(console)/(migration-wizard)/wizard.svelte
src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Configure dynamic routes using SvelteKit convention with [param] syntax in route directory names

Files:

  • src/routes/(console)/(migration-wizard)/wizard.svelte
🔇 Additional comments (3)
src/routes/(console)/(migration-wizard)/wizard.svelte (3)

60-60: LGTM!

Clean variable declaration with proper typing to track the newly created project.


129-131: Fix correctly addresses the self-hosted 404 issue.

The region fallback ?? 'default' properly handles self-hosted instances where region is undefined, and the newlyCreatedProject ?? currentSelectedProject logic ensures the correct project reference is used for navigation.

Note: currentSelectedProject can technically be undefined (from projects.find()), but this edge case is mitigated by the button's disabled state requiring a valid selection. This is consistent with existing patterns in the file (lines 151-152).


260-268: LGTM!

The newly created project is correctly captured after the null check, and the SDK instance is properly initialized with the new project's region and ID. This ensures onFinish has access to the correct project reference for navigation.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: Migration from Cloud to self-hosted redirects to a non existent page (404)

1 participant