Why Data API Builder data-api/graphql is returning 404? (Static Web App)

Adrian 0 Reputation points
2024-04-01T21:51:55.6466667+00:00

I'm trying to deploy Data API Builder to Static web app,

I already have config and schema
swa-db-connections/staticwebapp.database.config.json
swa-db-connections/staticwebapp.database.schema.gql User's image

https://url.../data-api/graphql and https://url.../data-api/api are returning 404

while random path e.g. /data-api/testapi is returning 400, invalid path

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
758 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 18,036 Reputation points Microsoft Employee
    2024-04-02T12:11:42.88+00:00

    @Adrian Thank you for posting your question in Microsoft Q&A, apologize for any inconvenience caused on this.

    I understand that you are trying to add a cosmos database connection in static webapps and hope you followed the documentation that were mentioned in this documentation.

    • I see in the above shared swa-db-connections/staticwebapp.database.config.json file in the entities section you are not passing the container name that is present in your db from which you want to query the data using graphql from the static webapps. Can you please check and update the entities section with your container name.
    • Also, when you have tested this application locally, where able to query the data from the cosmos db without any issues?
    • Once you deploy the application to static webapps, you need to request the root url (https://****.5.azurestaticapps.net/)of your static webapp instead of these urls (https://url.../data-api/graphql and https://url.../data-api/api).

    Hope this helps and let me know if you are still facing any issues.

    0 comments No comments