static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

API with Python 3.11 runtime fails "swa start"

Open chrisred opened this issue 8 months ago • 4 comments

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • [ ] No, I am using a different port number (--port) and accessing the CLI from that port
  • [X] Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Create a SWA project using a Python 3.11 API runtime
  2. Build the project with swa build my-project
  3. Start with swa start ./dist --api-location api
  4. swa start fails with "Failed to validate staticwebapp.config.json schema."

Expected behavior swa start should start the emulator successfully.

Desktop (please complete the following information):

  • OS: Fedora
  • Version 40

Additional context

Looks like the file at schema/staticwebapp.config.json doesn't match the list of supported runtimes at https://learn.microsoft.com/en-gb/azure/static-web-apps/configuration#select-the-api-language-runtime-version (python:3.11 is missing).

✖ Failed to validate staticwebapp.config.json schema. Errors: [
  {
    "type": "error",
    "name": "EnumError",
    "code": "enum-error",
    "message": "Expected given value `python:3.11` in `#/platform/apiRuntime` to be one of `[\"dotnet:3.1\",\"dotnet:6.0\",\"dotnet-isolated:6.0\",\"dotnet-isolated:7.0\",\"dotnet-isolated:8.0\",\"dotnet-isolated:9.0\",\"node:12\",\"node:14\",\"node:16\",\"node:18\",\"node:20\",\"python:3.8\",\"python:3.9\",\"python:3.10\"]`",
    "data": {
      "pointer": "#/platform/apiRuntime",
      "schema": {
        "type": "string",
        "enum": [
          "dotnet:3.1",
          "dotnet:6.0",
          "dotnet-isolated:6.0",
          "dotnet-isolated:7.0",
          "dotnet-isolated:8.0",
          "dotnet-isolated:9.0",
          "node:12",
          "node:14",
          "node:16",
          "node:18",
          "node:20",
          "python:3.8",
          "python:3.9",
          "python:3.10"
        ],
        "description": "Language runtime for the managed functions API"
      },
      "value": "python:3.11",
      "values": [
        "dotnet:3.1",
        "dotnet:6.0",
        "dotnet-isolated:6.0",
        "dotnet-isolated:7.0",
        "dotnet-isolated:8.0",
        "dotnet-isolated:9.0",
        "node:12",
        "node:14",
        "node:16",
        "node:18",
        "node:20",
        "python:3.8",
        "python:3.9",
        "python:3.10"
      ]
    }
  }
]

chrisred avatar Apr 13 '25 17:04 chrisred

Added PR #972 to resolve

stephlocke avatar Aug 08 '25 11:08 stephlocke

Hey @stephlocke , SWA runtime will be upgraded this month and will support python3.11. Thanks for your feedback

cjk7989 avatar Aug 11 '25 06:08 cjk7989

SWA runtime will be upgraded this month and will support python3.11

Does this mean my pr for this issue will be accepted or that the core team will be doing this? Trying to understand if it's worth doing more PRs around this type of issue (also did one for node with the functions runtime as it blocked my usage of the cli the other day) or if they'll be rejected.

stephlocke avatar Aug 11 '25 06:08 stephlocke

SWA runtime will be upgraded this month and will support python3.11

Does this mean my pr for this issue will be accepted or that the core team will be doing this? Trying to understand if it's worth doing more PRs around this type of issue (also did one for node with the functions runtime as it blocked my usage of the cli the other day) or if they'll be rejected.

Hi @stephlocke, I also prepared PR-967 similar to yours. It's based on the MS doc: https://learn.microsoft.com/en-us/azure/static-web-apps/languages-runtimes. Let's apply this one :)

cjk7989 avatar Aug 14 '25 08:08 cjk7989