aws-amplify / aws-amplify/amplify-hosting
imported API does not exist on hosting
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
### App Id
d18p64j6agbqkk
### AWS Region
us-east-1
### Amplify Hosting feature
Backend builds
### Describe the bug
I'm developing a dashboard for a backend that already has an API. As API imports are not yet supported in Amplify-cli I imported it to my Amplify project modifying the file aws-exports.js adding
```
aws_cloud_logic_custom: [
{
name: "DashboardAPI",
endpoint: "https://xxxxxxxx.execute-api.us-east-1.amazonaws.com/dev",
region: "us-east-1",
},
],
```
Locally it works fine. I can call my API and the API responds. Then I tried to host the web on Amplify Hosting. It builds correctly and I can access my dashboard. But when the dashboard tries to make a request to the API, I get the following error:
```
API DashboardAPI does not exist
```
Is it possible to deploy an app with an imported API? What other files do I need to manually modify?
Thank you and best regards
### Expected behavior
The web application can access the API correctly.
### Reproduction steps
1. Create an API
2. Import it locally in aws-exports.js
3. Try it locally
4. Deploy it in Amplify Hosting
### Build Settings
_No response_
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
Contributor guide
Research direction
Start with the manually modified aws-exports.js and the Amplify Hosting Backend builds configuration, comparing the local and hosted handling of the imported DashboardAPI. Confirm whether the deployed dashboard can access the imported API, or document the hosting limitation and required configuration if it cannot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100