# Edge Function deploy failed due to an internal error

When encountering the `Function deploy failed due to an internal error`, try deploy the function via the [Supabase CLI](https://supabase.com/kb/docs/guides/local-development) with the `--debug` flag to gather extra information to identify the possible cause.

You can also try [alternative bundle methods](https://supabase.com/kb/docs/reference/cli/supabase-functions-deploy):

- `--use-api`: Use Management API to bundle functions.
- `--use-docker`: Use Docker to bundle functions.

If you're not able to run the CLI or cannot identify the cause, [open a support ticket](https://supabase.com/kb/dashboard/support/new).

**Example error**

```
$ supabase functions deploy FUNCTION_NAME --remote=$PROJECT_ID
```

**Example output with `--debug`**

From the details we can see it is exceeding the 20MB [Edge Function size limit](https://supabase.com/kb/docs/guides/functions/limits):

```
$ supabase functions deploy FUNCTION_NAME --remote=$PROJECT_ID --debug
Deploying Function: FUNCTION_NAME (script size: 62.61MB)
```

## Related topics

- [Deploy Edge Functions](https://supabase.com/docs/guides/functions/deploy)
- [Edge Function bundle size issues](https://supabase.com/kb/troubleshooting/edge-function-bundle-size-issues)
- [Unable to deploy Edge Function](https://supabase.com/kb/troubleshooting/unable-to-deploy-edge-function)
