GraphQL 405 deployed on Azure but not locally

I am trying my first RedwoodJS app and it seems to be running fine locally. I have the DB set up in Railway and I just set up deployment to Azure Static Web Apps.

For some reason my queries to graphql throw a 405 in the hosted version of my app but not locally.

Please help! Thank you in advance

https://gentle-mud-0a1b61a0f.2.azurestaticapps.net/

Hi @tibble49 while I’ve never tried to deploy on Azure and currently we don’t have a supported deploy provider there … I have heard of the 405 error when people depot to Vercel and have not set the apiUrl config properly.

See Deploy to Vercel | RedwoodJS Docs

So, perhaps there is a similar reason for Azure deploys.

May I ask how you have deployed your api side?

Tagging @talk2MeGooseman since he probably has the most experience right now using Redwood with Azure.

We also have a long running thread in regards to Azure Static Web Apps so take a look at that as well if you haven’t already:

I believe this would be the fix to your issue. If that’s not the case, I can try setting up a test app to see if I can replicate the issue and how I remedied it before.

Hey @tibble49,
I set this up just a few days ago. But only for the frontend. Did not manage to get Azure to deploy the backend to a function. I will keep the discussion about the backend in the thread @ajcwebdev mentioned.

For the frontend I used the github integration (Deployment details on the first page of the create page for the static web app) which sets up the following deploy script:

steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        env: # Add environment variables here
          API_URL: ${{ secrets.STAGE_API_URL }}
          
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENERATED }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: 'upload'
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: '/' # App source code path
          api_location: 'api/dist' # Api source code path - optional
          output_location: 'web/dist' # Built app content directory - optional
          app_build_command: yarn rw build
          ###### End of Repository/Build Configurations ######

And we added a staticwebapp.config.json to our root

{
  "routes": [
    {
      "route": "/index.html",
      "headers": {
        "cache-control": "no-store, must-revalidate, no-cache"
      }
    }
  ],
  "navigationFallback": {
    "rewrite": "/index.html",
    "exclude": ["*.{svg,png,jpg,gif}", "*.{css,scss}", "*.js"]
  }
}

Silly me, I just realized I never deleted the repository I used to deploy my example RedwoodJS web app. @tibble49 if you still need help resolving your issue, look at my repo GitHub - talk2MeGooseman/redwood-goose. It is the default-generated app, so it should be ok to follow.