azure-dev: Start api in vscode failed when run vscode tests in todo-python-mongo-swa-func

Describe the issue: Run task Start API and Web successfully. But, when open the web site, the page keeps loading. The error is as follows: image image

Repro Steps:

  1. Run bash ./test-templates.sh -t todo-python-mongo-swa-func -b staging -c false
  2. Open the project in VS Code
  3. Hit F1, Run Task, Start API and Web

Environment:

Remark: Issue1 only occurs in Dev container in VS Code, and Issue2 occurs in both Linux desktop and Dev container in VS Code.

Expected behavior: Start api in vscode successfully when run vscode tests.

@rajeshkamal5050 for notification.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (17 by maintainers)

Most upvoted comments

The issue about CORS is root caused to the task Start Functions It runs "command": "host start --port 3100 --cors *", where cors is ignored.

So the Function is started by it sets CORS to deny all origins. This is why this is only reproducible by running Start API and not when running Debug API, since running Debug API uses python directly to start the API instead of hosting the API in a simulated Azure Function (like Start API does).

Changing the command to: "command": "host start --port 3100 --cors '*'", fixes the issue, as it starts the Function allowing all CORS.

I will create a PR for this.

The CORS issue was reported with the current templates, so it shouldn’t be blocking for the release. We can always also ship out a template release, so we shouldn’t be blocking CLI on it. I’ll confirm the behavior though.

The issue is not always reproducible because it will happen only when the expiration time contains microseconds.

I will create a new issue for that.