> ## Documentation Index
> Fetch the complete documentation index at: https://converge-enter-documentation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Plan and test Cloud functions

A **Cloud function** does work that shouldn't run in a visitor's browser. You decide when you need one, describe the behavior, and test the whole flow. You don't need to read its code or change its sign-in settings.

## Know when you need a Cloud function

Keep layout, form behavior, and result display on the page (the frontend). Ask for a Cloud function when the app needs to:

* Send an email or notification through an outside service.
* Call a third-party API that needs a private credential.
* Check a request or make a protected data change on the server.

**Example:** A visitor submits a contact form. The page collects the message and shows the result. A Cloud function checks the request, calls the email service with a saved secret, and returns success or an error.

```mermaid theme={null}
flowchart TD
  A[Visitor submits form] --> B[Page sends request]
  B --> C[Cloud function]
  C --> D[Validates input]
  D --> E[Calls email service with saved secret]
  E --> F[Returns success or error]
  F --> G[Page shows the result]
```

> [!CAUTION]
>
> **Keep secrets out of the page.** Store API keys in [secret storage](https://converge-enter-documentation.mintlify.site/en/articles/add-and-update-cloud-secrets.md), never in frontend code, browser requests, screenshots, or visible errors. Name the service and secret the function should use. Don't move a key into the page to fix a failed request.

## Describe the flow you want

Tell Enter what should happen, not how to set up sign-in checks. Cover four parts.

| Part | What to say |
| - | - |
| **Input** | What the visitor provides. |
| **Access** | Who may submit the request. |
| **Success** | What happens after a successful submission. |
| **Failure** | What the page shows when the request fails. |

Copy and adapt this example:

```plaintext theme={null}
Build a contact form that accepts a name, email address, and message. Any visitor may submit it. Send the message to our support address using the configured email-service secret. Show a confirmation after success, and show a clear retry message if the request fails.
```

![Describe input, access, success, and failure in project chat.](https://mintcdn.com/converge-enter-documentation/Dl1DSbRP-YuWE4KM/images/enter-help/3.3/flow-prompt.png?fit=max\&auto=format\&n=Dl1DSbRP-YuWE4KM\&q=85\&s=10be8b26e94e23397cb9224d8ab0da6a)

Describe input, access, success, and failure in project chat.

## Test the complete flow

* [ ] Submit valid input and confirm the page shows success.

* [ ] Confirm the real result happened, such as an email arriving or data being updated.

* [ ] Submit invalid or incomplete input. The page should show a useful error with no keys or internal details.

## Troubleshooting

> [accordion] The function exists but the page does nothing
>
> A function that exists doesn't prove the page calls it or the service accepts its request. Ask Enter for the complete user flow.

> [accordion] A test fails
>
> Tell Enter what you did, what you expected, what happened, and the error on the page.

> [accordion] An authentication error appears
>
> Don't switch off authentication checks. Ask Enter to review how the page calls the function and fix it safely.

## Common questions

> [accordion] When does my app need a Cloud function?
>
> Use a Cloud function when your app must handle a private credential, validate a request, or make a protected data change on the server. Keep layout, form behavior, and result display in the frontend.

> [accordion] Where should a Cloud function get private credentials?
>
> Save each credential in [Cloud Secrets](https://converge-enter-documentation.mintlify.site/en/articles/add-and-update-cloud-secrets.md) and refer to it by name. Never place the value in frontend code, browser requests, project chat, screenshots, or visible errors.

## Keep going

> [!NOTE]
>
> **Next:** [**Add and protect Cloud secrets**](https://converge-enter-documentation.mintlify.site/en/articles/add-and-update-cloud-secrets.md)\
> Your function needs its private key saved safely.

> [card] [Connect Stripe for app payments](https://converge-enter-documentation.mintlify.site/en/articles/connect-stripe-for-app-payments.md)
>
> Take payments with a Stripe checkout.

> [card] [Create, manage, and delete an Enter Cloud instance](https://converge-enter-documentation.mintlify.site/en/articles/create-and-manage-an-enter-cloud-instance.md)
>
> Open and manage your Cloud instance.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.