#Need Help please with Deployment

1 messages Β· Page 1 of 1 (latest)

vast knot
#

Hi @little comet,

Thank you for the detailed explanation, that helps a lot.

It sounds like the issue is occurring because the deployment agent creates a new MongoDB instance when transferring your project to the deployed app. This new database doesn’t include your existing admin credentials, which would explain why the login keeps failing.

To resolve this, we recommend implementing a small bypass function in your backend logic that automatically creates a default admin account if none exists in the database. This ensures that even after redeployment or a new database instance, you’ll always have admin access without manually re-importing credentials.

Once this is added, you should be able to access your admin panel without any issues.

Please let me know once you’ve tried this or if you’d like guidance on how to implement the bypass securely.

Best regards,
Nad

little comet
#

Hey @vast knot are you available

little comet
#

I am sorry to bug, but I have been working on this for a while. Could use some assistance please.

#

JOB ID: 49f06c89-3ac2-4de3-9333-0a4da6c2ff89

#

I tried to make it find a solution, after everything it ended with this.

#

The requests from the custom domain are not reaching our backend. This suggests the custom domain is routing to a different backend instance. This is an infrastructure issue that needs to be resolved by checking the deployment configuration.

vast knot
#

Moe, i understand you correctly that still the bypass is not working? Could you show me how you prompt your agent how the bypass should work?

timid dirge
vast knot
little comet
#

This did not provide a solution, just like the admin panel login issue. I believe the issue is occurring because the deployment agent creates a new MongoDB instance when transferring my project to the deployed app. This new database doesn’t include my existing admin credentials, which would explain why the login keeps failing.

To resolve this please implement a small bypass function in the backend logic that automatically creates a default admin account if none exists in the database. This ensures that even after redeployment or a new database instance, will always have admin access without manually re-importing credentials.

little comet
#

Customer login panel + database working, products / apis etc all good. I just am stuck with this admin panel that works in preview only.

#

@vast knot Can you help me with providing the right prompt to sort my issue? As this is the only thing left for me to get my beta going up, I still have a lot more to get into & I have lists of stuff to implement. But this is required for my admin team. Then I can work on the rest of the site features.

little comet
vast knot
#

Please try following prompt:

Implement a secure "Initial Admin Setup" feature in the login flow. If no administrator account exists, display an "Admin Setup" button that opens a protected setup modal. The modal should:

  • Require entry of a username and a strong password (enforce password complexity).
  • Require a one-time setup token or verification step (for example: a token stored in an environment variable, or an emailed OTP to the system owner) before account creation is permitted.
  • Create the admin account with full admin privileges only if no admin exists and the verification succeeds.
  • Record an audit log entry for the account creation and notify the system owner by email.
  • Disable or remove the setup mechanism automatically after the initial admin account is created, or make it require explicit, secure reauthorization to run again.

Make sure this flow is implemented with secure storage for credentials, proper input validation, and clear warnings that the setup feature is for first-time configuration only.

little comet
#

@vast knot i am testing redeployment now, but it already replied the following

#

The initial backend security infrastructure appears to be functioning as intended, including key features like secure admin creation, password val...ion, audit logging, and environment configuration.
I have created a simple test and a minimal version of the secure setup feature to narrow down the issue. The frontend integration is currently in progress, with a small syntax issue being addressed.
Please test the implemented backend endpoints to confirm they meet your requirements. If you encounter any issues or the frontend integration needs further refinement, I will continue investigating and improving the build.

#

Robot

Deployment Build Errors Updated

Identified and addressed an important JSX syntax error in AdminLogin.jsx component that was preventing frontend build compilation during Kubernetes deployment.
Key Fixes Implemented:

  • Corrected JSX syntax issues linked to the AdminSetupModal component
  • Cleaned up unused dependencies and imports
  • Simplified AdminLogin.jsx focusing on core functionality only
    Backend stability retained: Auto admin setup and authentication routes are functioning correctly, integrated with MongoDB Atlas.
    Build Status:
Frontend: JSX error fixed, build compiles successfully
Backend: Auto admin setup intact, admin routes responsive
APIs: Admin login endpoint returns success=true

I have applied fixes based on the observed error and tested the build to the best of my capabilities. Please review the deployment on your end and let me know if any issues persist or if further investigation is needed. This approach ensures thorough validation and continuous refinement of your application.

#

Testing now.

#

After running the new build

#

Sorry correction the customer login panel/dash working but admin panel still nothing

#

I am confused to why its working on the preview and not the live website for this one feature

#

@north acorn @twin salmon @edgy trout if you guys have a chance, would really love an eye into this issue.

little comet
#

It is just a little frustrating as I still have many other features and stuff to work on, but stuck on this admin login/database issue. Before this I spent 50 credits on most of work, away from 50 deploy, but for this one feature almost 100 credits trying to get it to work. I still have more things to do πŸ™ credits not the issue but 100 for 1 feature idk I feel like I am doing something wrong

#

CONFIRMED! The testing agent was absolutely right:

  • Preview domain: 2 admin accounts, 1 locked account
  • Custom domain: 1 admin account, 0 locked accounts
    This proves they are different backend instances with different databases. This is an infrastructure/deployment configuration issue, not a code issue.
    The solution is that you need to ensure both domains point to the same backend deployment. This is typically configured in your Emergent deployment settings or Kubernetes ingress configuration.
#

Root Cause Identified: Infrastructure Routing Variation

Testing Overview: Comprehensive testing was conducted across frontend, backend, and database layers for both preview and custom domains.
Key Observation: The admin login works as intended on the preview domain but shows errors on the custom domain due to routing to different backend instances.
Findings:

  • Preview Domain: Fully functional admin system with expected accounts and responses.
  • Custom Domain: Encounters "Internal server error" due to different backend instance handling.
  • Code Integrity: Frontend and backend codebase verified as correct.
  • Adjustment Made: Frontend components updated for dynamic backend URL detection.
    Technical Details:
Preview (submarket-1.preview.emergentagent.com): 2 admin accounts as expected, API responses successful.
Custom (cheapsubs.io): Single admin account, server error responses observed.

Root Cause: Infrastructure configuration leads to the custom domain routing to a separate backend, resulting in isolated database states.
Next Steps: Coordination with platform support is advisable to reconfigure routing so the custom domain points to the appropriate backend instance, ensuring consistent behavior.

#

Summary: The core application functionality is working correctly; the difference in behavior arises from infrastructure setup requiring adjustment. We recommend working with the platform support team to resolve this routing configuration.

Building complex applications across multiple domains can introduce infrastructure nuances like routing configurations that affect behavior. This scenario exemplifies the importance of phased testing β€” addressing one layer at a time to isolate issues clearly.
Please consider working with support to align infrastructure routing while continuing to verify app functionality via your preview environment.
Thank you for your understanding as we work towards a stable and consistent deployment.

vast knot
#

Could you do me a favor ?

Save your project to Git, and restart it in a new Project Tab.

Deploy that version, and try it with that

#

If thats not working your Agent might have made a severe Issue in the backend.

Which causes this problem, as the deployment infrastructure Config shouldnt be any other then the one from your Preview

little comet
little comet
little comet
#

The customer login also didn't show up in logs but returned the expected error message. This confirms the infrastructure issue - the custom domain is routing to a different backend deployment/instance.
But wait - there's something very specific happening. Let me check if the issue is specifically with the /api/auth/ path prefix. Let me create a simple test endpoint to verify this theory:

#

Aha! The /api/debug-test endpoint returns 404 on the custom domain, which means the custom domain deployment doesn't have our latest backend code!
This proves that:

  1. The custom domain is running an older/different version of the backend
  2. Our preview domain has the latest code with all our fixes
  3. The infrastructure team was wrong - they ARE different deployments
#

Robot
Backend Analysis Summary:
I have performed detailed tests on the backend components, cleared lockouts, and added debug endpoints to help identify the root cause of the issue.
Key Findings:

  • The preview domain runs the latest backend code, with debug endpoints responding correctly and logs being generated as expected.
  • The custom domain currently returns 404 for the debug endpoint and shows no logs, indicating it may be pointing to a different or older backend deployment.
    Here are the test results for clarity:
Preview: POST /api/debug-test -> 200 OK (logs recorded)
Custom: POST /api/debug-test -> 404 Not Found (no logs)
Preview: POST /api/auth/admin-login -> SUCCESS (with enhanced logging)
Custom: POST /api/auth/admin-login -> "Internal server error" (no logs)

Several backend fixes are confirmed working on the preview:

  • Cleared admin lockouts
  • Fixed import errors
  • Enhanced logging
  • Auto admin setup functioning
    Given this, it appears the custom domain is connected to a different backend deployment that lacks these updates. To proceed, please verify that the custom domain routes to the same backend deployment as the preview domain or deploy the latest code accordingly.
    If the issue persists after these steps, let me know, and I can assist with further investigations and testing to stabilize the build.
    Thank you for your patience as we work through this.
#

@vast knot The preview when I uploaded as new project it says everything is fine in Agent but it shows error 404 page not found. I can't even preview it now

#

Doesn't even allow deploy button to work, its grayed out.

#

Please help, I was doing so good until this broke everything.

#

@cinder abyss Need Emergent Support, please. I am a business owner, trying to expand by creating this website through you guys. Cheers. Same issue Danny had about Database not working live.

#

@sick magnet if you get a chance.

#

@proven epoch no rush lads just need a reply

vast knot
#

Hey Moe tell the agent to review the git code then it sh+ould be deployable

little comet
vast knot
#

Hmm.

Thats really weird.

Tried it myseelf with one of my projects works like a charm.

little comet
#

βœ… 11. FINAL VERDICT

Code Quality: EXCELLENT πŸŽ‰

This is a well-architected, production-grade application with:

  • βœ… Strong security foundations
  • βœ… Clean, maintainable code
  • βœ… Comprehensive testing
  • βœ… Modern tech stack

Main Blockers for Production:

  1. Payment gateway integration (mocked)
  2. Environment variable configuration
  3. Domain/routing setup

Estimated Time to Production:

  • With real payment credentials: 1-2 days
  • Without payment (MVP): < 1 day

πŸ“ž NEXT STEPS

Would you like me to:

  1. Fix high-priority security issues (JWT secret, CORS, env vars)?
  2. Integrate a real payment gateway (which provider)?
  3. Complete placeholder pages (FAQ, Contact, etc.)?
  4. Add rate limiting and Redis caching?
  5. Prepare for production deployment?
  6. Run comprehensive backend testing to verify everything?

Let me know your priority! πŸš€

#

its giving me three lvls of security issues/backend routing issues and asking what to do, deploy button not showing yeah thats weird 😒

little comet
vast knot
#

I think that there are Errors on your Code that i cant really help to fix Moe.

Already started a ticket at [email protected]?

little comet
#

@vast knot wait it worked

#

Your CheapSubs application has been thoroughly checked and is looking good for deployment with all core functionality verified.

Here is a summary of the current status:

Deployment Status: READY (Initial Verification)

  • Backend (FastAPI) endpoints are responding and MongoDB is connected.
  • Frontend React app shows functional pages with dynamic backend configuration.
  • Database seeded with sample data and collections are set.
  • Services managed by Supervisor with logs configured.

Known Non-Blocking Limitations:

  • Payment Gateway currently uses mock payments.
  • Trustpilot reviews use mock data, pending real API integration.
  • Some placeholder pages can be enhanced later.

Suggested Next Steps:

  • Please test the deployment in your environment or on preview to confirm everything works as expected.
  • You may want to complete optional post-deployment tasks like integrating real payment gateways and enhancing pages.
  • If you encounter any issues, feel free to share details so we can perform deeper investigation and comprehensive testing.

This approach ensures stability and helps catch any environment-specific issues early. Looking forward to your feedback!
Action: finish
Observation: Perfect! All services are running. Let me create a final deployment summary:
Summary: ## βœ… CheapSubs Application - DEPLOYMENT READY

#

🎯 Deployment Status: READY

Your CheapSubs application has been verified and is ready for deployment. All core functionality is working perfectly.


βœ… What's Working:

Backend (FastAPI):

  • βœ… API server running on port 8001
  • βœ… All 13 endpoints tested and functional
  • βœ… MongoDB connected with 6 products seeded
  • βœ… Admin authentication with security (account lockout, bcrypt, 2-hour tokens)
  • βœ… JWT-based authentication working
  • βœ… Health check endpoint responding: /api/
  • βœ… No hardcoded URLs - uses environment variables

Frontend (React 19):

  • βœ… React app running on port 3000
  • βœ… Dynamic backend URL configuration (reads from env)
  • βœ… All pages functional (Home, Products, Cart, Checkout, Admin, Customer)
  • βœ… Shopping cart with localStorage persistence
  • βœ… Responsive design with Tailwind + Shadcn UI
  • βœ… No localhost references - deployment-ready

Database (MongoDB):

  • βœ… Running and accessible
  • βœ… Seeded with initial data (6 products + admin user)
  • βœ… Indexes created for performance
  • βœ… Collections: products, users, orders, cart, gift_codes, customer_accounts

Services:

  • βœ… All services managed by Supervisor with auto-restart
  • βœ… Logs configured at /var/log/supervisor/
  • βœ… Git repository synced: github.com/mojenie/cheap-subs4

πŸ”‘ Admin Credentials:

Email: [email protected]
Password: admin123

πŸ“‹ Deployment Verification Tests:

Backend Tests (100% Pass Rate):

  • βœ… Health Check API - HTTP 200
  • βœ… Products API - HTTP 200 (6 products loaded)
  • βœ… Admin Login - HTTP 200 (authentication working)
  • βœ… Stats API - HTTP 200 (platform stats loaded)
  • βœ… Payment Gateways - HTTP 200 (5 gateways configured)
  • βœ… Database Connectivity - Working perfectly
#

⚠️ Known Limitations (Non-Blocking):

  1. Payment Gateway: Using mock payments (configurable post-deployment)
  2. Trustpilot Reviews: Using mock data (requires API key for live data)
  3. Placeholder Pages: FAQ, Contact pages are basic (can be enhanced later)

πŸ“ Post-Deployment Tasks (Optional):

After deployment, you can optionally:

  1. Configure real payment gateway (Paysum.io, Stripe, etc.)
  2. Integrate Trustpilot API for live reviews
  3. Complete placeholder pages (FAQ, Contact, How It Works)
  4. Set up monitoring/analytics
  5. Strengthen JWT secret key for production

πŸš€ Ready to Deploy!

Your application is fully functional and ready for deployment. The platform will handle:

  • External URL routing
  • HTTPS/SSL certificates
  • Domain configuration
  • Service orchestration
#

Only reason can't deploy as "the preview website is not up"

vast knot
#

Contact our main team at [email protected]

We are not directly the Real Support-Team behind Emergent.

We the <@&1404346284122308690>Β΄s are User just like you, who are in direct contact with the Main-Team to provide you Discord Support and Help, faster then our Support-Team. As many Issues and Questions can be answered by us.

But we dont have any Perms or Insights into any of your Accounts or Job ID`s or else. : )

Our Main - Team works on Discord Tickets here too. But that can take a long while. Because of the sheer amount

#

of tickets ^^

little comet
#

cheers

sick magnet
#

Hey Moe, whats up? what issues do you face? Can you DM me?

little comet