getPayload for Payload Cloud instead of Rest API?

default discord avatar
face44
last month
5

We have an app which was previously using locally hosted Payload and was relying on

getPayload

function to connect to the service.



Now, we are migrating to Payload Cloud and realising that we'll have to rewrite all the services to use Rest APIs.



Is there a way that we can reuse our structure and simply connect to the cloud using something similar to

getPayload

?

  • discord user avatar
    denolfe
    Payload Team
    last month

    Interesting, I might be missing something in how you're using Payload, but how does hosting this in Payload Cloud change your usage?



    Now, we are migrating to Payload Cloud and realising that we'll have to rewrite all the services to use Rest APIs.

    Can you expand upon why you think that's the case?

  • default discord avatar
    Erielia
    last month

    I had this same query, actually.



    I think the assumption is that the local API won’t work on payload cloud because payload is doing the work of connecting up to atlas mongo etc, while a front-end consumer of the payload cloud instance isn’t locally hosted alongside it, so presumably you need to use REST or GraphQL APIs to consume the data, for example in a nextjs app on vercel?

  • discord user avatar
    denolfe
    Payload Team
    last month

    Hmm, we already expose the mongo connection string in the Cloud UI. I bet we could expose the payload secret as well. This would allow you to do

    payload.init

    from anywhere.



    Would that solve for this use-case?

  • default discord avatar
    face44
    last month

    Hey,



    @Erielia summed it up pretty nicely.



    @denolfe


    I believe we'll be set if I am getting


    1. Mongo connection string


    2. Payload Secret


    3. Config? Can I get it?

  • discord user avatar
    denolfe
    Payload Team
    last month

    Wherever you're performing your

    payload.init

    would need access to the config, but that's coming from your code repository in the first-place. It's not

    stored

    in Payload Cloud for retrieval or anything like that.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.