Question

Unable to connect with MongoDB cluster from Laravel App Platform app

I have a laravel app deployed in DO App platform but when I add my laravel app to trusted sources it could not connect to managed mongodb database anymore. However, when I open the DB for all connections, it connects and work successfully.

I am using laravel mongodb extension v5.1 to connect with mongodb. Anyone faced this problem and resolved it?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

    Bobby Iliev
    Site Moderator
    Site Moderator badge
    December 23, 2024

    Hi there,

    Are you truing to connect to the MongoDB cluster during the build stage?

    If this is the case, keep in mind that during the build process your app would not have access to the Managed Database clusters in case that you have the trusted sources enabled.

    What I would suggest is that if you have any steps that are connecting to your managed databases, you could move thise steps from the build process to the deploy process.

    In general, the benefit of doing this is that, if your build is successful and the changes to the database are executed, but the deployment fails, then you might end up with the new database schema but with your old codebase which might not be backwards compatible.

    Let me know how it goes!

    - Bobby

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Become a contributor for community

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    DigitalOcean Documentation

    Full documentation for every DigitalOcean product.

    Resources for startups and SMBs

    The Wave has everything you need to know about building a business, from raising funding to marketing your product.

    Get our newsletter

    Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

    New accounts only. By submitting your email you agree to our Privacy Policy

    The developer cloud

    Scale up as you grow — whether you're running one virtual machine or ten thousand.

    Get started for free

    Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

    *This promotional offer applies to new accounts only.