Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
324 stars 56 forks source link

Cannot reconnect GitHub repo using az cli: HTTP 500 #536

Open abatishchev opened 3 years ago

abatishchev commented 3 years ago

Describe the bug

I want to change the branch name of the GitHub repo. Azure Portal doesn't allow to do that right now. Nor does ARM template:

Branch is invalid. Cannot change the Branch. Please detach your static site first if you wish to attach to another branch

I was able to disconnect by running az staticwebapp disconnect. Now I'm trying to connect back by running az staticwebapp reconnect. However it fails with 500.

To Reproduce

az staticwebapp reconnect --name godfathernetru --branch html --source https://github.com/abatishchev/godfather.net.ru.git --login-with-github
Command group 'staticwebapp' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Please navigate to https://github.com/login/device and enter the user code 3DC9-2492 to activate and retrieve your github personal access token
Waiting up to '14' minutes for activation
Operation returned an invalid status 'Internal Server Error'

Git repo: https://github.com/abatishchev/godfather.net.ru Branch: html

Expected behavior

It doesn't return 500.

Screenshots If applicable, add screenshots to help explain your problem.

Device info (if applicable):

az version
{
  "azure-cli": "2.26.1",
  "azure-cli-core": "2.26.1",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "azure-iot": "0.9.7"
  }
}
abatishchev commented 3 years ago

I was able to locate the correlation ID for the most recent failure: fd5003d6-bca7-4773-a9f8-110f643455e3. I see the corresponding HTTP 500 in ARM logs.

miwebst commented 3 years ago

Hey @abatishchev , looks like a backend error. Can you remove '.git' from the source above?

abatishchev commented 3 years ago

@miwebst thanks! it worked now. can you please file a bug and improve the input validation? it must be 400, not 500,

abatishchev commented 3 years ago

@miwebst have this been fixed?

satoryu commented 1 year ago

I'm running into similar situation but in my case the message is not 'Internal server error' , 'Static Web App satoryu-com already exists in resource group satoryu.com'

What I did

Output

Static Web App satoryu-com already exists in resource group satoryu.com
{
  "allowConfigFileUpdates": true,
  "branch": null,
  "buildProperties": null,
  "contentDistributionEndpoint": "https://content-hk1.infrastructure.azurestaticapps.net",
  "customDomains": [
    "www.satoryu.com"
  ],
  "defaultHostname": "nice-field-0cd594e00.azurestaticapps.net",
  "enterpriseGradeCdnStatus": "Disabled",
  "id": "/subscriptions/55d4a30f-fb2f-4d50-8d74-474139b4c425/resourceGroups/satoryu.com/providers/Microsoft.Web/staticSites/satoryu-com",
  "identity": null,
  "keyVaultReferenceIdentity": "SystemAssigned",
  "kind": null,
  "linkedBackends": [],
  "location": "East Asia",
  "name": "satoryu-com",
  "privateEndpointConnections": [],
  "provider": "None",
  "publicNetworkAccess": null,
  "repositoryToken": null,
  "repositoryUrl": null,
  "resourceGroup": "satoryu.com",
  "sku": {
    "capabilities": null,
    "capacity": null,
    "family": null,
    "locations": null,
    "name": "Free",
    "size": null,
    "skuCapacity": null,
    "tier": "Free"
  },
  "stagingEnvironmentPolicy": "Enabled",
  "tags": {
    "hidden-link: /app-insights-instrmentation-key": "84ff6644-5a1b-45fb-bdef-8d9930b4f002"
  },
  "templateProperties": null,
  "type": "Microsoft.Web/staticSites",
  "userProvidedFunctionApps": null
}
Command ran in 2.059 seconds (init: 0.112, invoke: 1.947)
bahree commented 1 year ago

I am having the same issue; I also tried with the token, in addition to the option of --login-with-github, I also used the --token option but unfortunately get the same error.

"Static Web App desigeek-blog-test already exists in resource group rg_blog".

Is this a bug, or a user error? Any suggestions?

Thanks.

arapl3y commented 1 year ago

I'm also experiencing the same issue...

az staticwebapp reconnect -n APP_NAME --source GITHUB_REPO_URL -b main --login-with-github

Static Web App X already exists in resource group X
LeonarddeR commented 12 months ago

I'm also suffering from exactly the same issue as the people above.

3xtant commented 10 months ago

This issue still persists as of Nov 5, 2023

> az --version
azure-cli                         2.53.1

core                              2.53.1
telemetry                          1.1.0

Dependencies:
msal                            1.24.0b2
azure-mgmt-resource             23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\<myusername>\.azure\cliextensions'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.
abatishchev commented 10 months ago

What frustrates the most is the amount of attention this issue had seen from the owners past 2.5 years (!) - none.

mvanhil commented 9 months ago

I have the same issue

Runeloon commented 8 months ago

Same issue here. Have to fully recreate the Azure Web App from scratch. Especially annoying since it appears to be the only way of updating the source since the portal UI doesn't support this.

konrad-jamrozik commented 8 months ago

+1, same issue here: Static Web App foo already exists in resource group foo

gopi-hl commented 8 months ago

I'm also suffering from exactly the same issue as the people above.

Is there any timeline for this at all? - deleting the app and recreating seems to be the only way out. How do we even do this when users are using the site live? Absolutely unacceptable, folks!

CGFNSOrg commented 7 months ago

I got the same error "Static Web App foo already exists in resource group fum" when I used the development token (from the static web app overview page) instead of a personal access token from the repo on GitHub. Oops. Used the right token and it worked fine.

dslatkin commented 6 months ago

Getting the same error as others trying to change the repo, thankfully only while initially testing things and trying to move it to a more permanent location. You should be able to do it, according to this comment. I wonder if this should be a separate issue now, no longer being an HTTP 500 like in the title.

As posted by @gopi-hl,

deleting the app and recreating seems to be the only way out. How do we even do this when users are using the site live?

this is a concerning issue.

Here's my log:

$ az staticwebapp reconnect -n **REDACTED** -b **REDACTED** -s **REDACTED** --login-with-github
Static Web App **REDACTED** already exists in resource group **REDACTED**
{
  "allowConfigFileUpdates": true,
  "branch": null,
  "buildProperties": null,
  "contentDistributionEndpoint": "https://content-wus2.infrastructure.4.azurestaticapps.net",
  "customDomains": [],
  "databaseConnections": [],
  "defaultHostname": "**REDACTED**",
  "enterpriseGradeCdnStatus": "Disabled",
  "id": "/subscriptions/**REDACTED**/resourceGroups/**REDACTED**/providers/Microsoft.Web/staticSites/**REDACTED**",
  "identity": null,
  "keyVaultReferenceIdentity": "SystemAssigned",
  "kind": null,
  "linkedBackends": [],
  "location": "West US 2",
  "name": "**REDACTED**",
  "privateEndpointConnections": [],
  "provider": "None",
  "publicNetworkAccess": null,
  "repositoryToken": null,
  "repositoryUrl": null,
  "resourceGroup": "**REDACTED**",
  "sku": {
    "capabilities": null,
    "capacity": null,
    "family": null,
    "locations": null,
    "name": "Free",
    "size": null,
    "skuCapacity": null,
    "tier": "Free"
  },
  "stagingEnvironmentPolicy": "Enabled",
  "tags": null,
  "templateProperties": null,
  "type": "Microsoft.Web/staticSites",
  "userProvidedFunctionApps": null
}
Joelith commented 6 months ago

I have the exact same issue. It's as if reconnect doesn't actually work. Looking at --debug shows that it attempts to look for the current static web app, but I'm assumming incorrectly prevents you from overwriting it as the site already exists (which is the point of reconnect the site must exist before!)

Is there any movement to fix this?

ksdaniel commented 4 months ago

I have the exact same issue. It's as if reconnect doesn't actually work. Looking at --debug shows that it attempts to look for the current static web app, but I'm assumming incorrectly prevents you from overwriting it as the site already exists (which is the point of reconnect the site must exist before!)

Is there any movement to fix this?

Nope - problem is still there!

cloudhal commented 3 weeks ago

Same issue here...wonder if this will ever be fixed?!