Replit Auth 和 Replit storage 在 Replit 外無法運作,需更換登入與儲存服務
Replit Auth and Replit storage don't work outside Replit
使用 Replit Agent 建立的應用程式移至 Replit 以外後,Replit 帳戶登入會因未設定 REPLIT_DOMAINS 而失敗,檔案儲存或載入亦會出錯。
An app built by Replit's Agent signs people in with their Replit accounts and keeps files in Replit's storage. Moved anywhere else, nobody can sign in. Change both first.
What you see
Deployed outside Replit, sign-in fails (REPLIT_DOMAINS isn't set), and saving or loading files errors.
Why it happens
server/replitAuth.ts signs people in through Replit's login service, and @replit/object-storage and @replit/database are Replit's own services. None of them exist outside Replit.
How to fix it
- Ask Replit's Agent, or your AI tool, to switch sign-in to Clerk or Supabase Auth.
- Move files to Cloudflare R2 or Supabase Storage, and Replit Database records into Postgres.
- Bring the Postgres data along: in Replit's Shell,
pg_dump -Fc --no-owner --no-privileges "$DATABASE_URL" > replit.dump.
Or ask your AI tool to fix it
Paste this into Lovable, Bolt, v0, Replit or Cursor:
This app has to run outside Replit. Replace sign-in with Replit accounts (server/replitAuth.ts, REPLIT_DOMAINS) with Clerk, and replace @replit/object-storage and @replit/database with S3-compatible storage (Cloudflare R2) and Postgres. Keep every page and API route working the same way.
The full page, with the request ready to copy, is at launchpad.axonscape.com/fix/replit-auth-outside-replit. I work on Launchpad by Axonscape, which runs a free launch check for apps built with AI tools: it finds this and the other things that break at launch, from a public GitHub repo or a .zip of the code, and keeps nothing.
來源:DEV Community · dev.to