Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upload to simple HTML to SWA using swa deploy command #591

Closed
1 of 2 tasks
doggy8088 opened this issue Oct 18, 2022 · 6 comments
Closed
1 of 2 tasks

Can't upload to simple HTML to SWA using swa deploy command #591

doggy8088 opened this issue Oct 18, 2022 · 6 comments
Assignees

Comments

@doggy8088
Copy link

doggy8088 commented Oct 18, 2022

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
  • 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.

I'm trying to upload HTMLs to the SWA. But nothing will be uploaded.

swa --verbose log deploy --env will --app-name aaabbccc -R ProjectDemo

image

To Reproduce
Steps to reproduce the behavior:

  1. mkdir aa

  2. cd aa

  3. echo 'Hello world' > index.html

  4. swa login

    image

  5. Upload files

    swa --verbose log deploy --env will --app-name aaabbccc -R ProjectDemo

    image

    The SWA is actually not uploaded. I can't see any error on my Terminal screen.

    image

Expected behavior

I expected to upload files successfully.

Screenshots

See above.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 10.0.19043.2130

Additional context

Even I added --verbose log, but I still can't see more logs. Is there any way to debug swa-cli?

@Reshmi-Sriram
Copy link
Contributor

Hi @doggy8088,
Apologies for the experience! To begin with, could you please try the command --verbose=silly to be able to see the more logs in the commandline?
And regarding the issue, it is a known bug as of now and the team is actively working towards enabling deployment from the root folder (which so happens to be the case for most of the simple HTML apps). You can read more about this here.
As an alternative, I'd recommend trying to set up an app-location with the index.html in it and try swa deploy --app-location ... command to see if this works.

Related to #514

@doggy8088
Copy link
Author

The workaround doesn't works.

swa deploy --verbose=silly --env production --app-name aaabbccc -R ProjectDemo --app-location .
Welcome to Azure Static Web Apps CLI (1.0.3)

Getting config file options from swa-cli.config.json...
Config file does not exist at G:\Projects\aa\swa-cli.config.json
Deploying front-end files from folder:
  G:\Projects\aa

No deployment token found. Trying interactive login...
Checking Azure session...
Executing authenticateWithAzureIdentity
- details:
  - tenantId: 76275315-7a75-*****
  - clientId: <undefined>
  - clientSecret: <undefined>
 - useKeychain: true
Keychain is enabled
Executing swaCliPersistencePlugin
Executing before cache access plugin
Machine ID: <hidden>
Invoking crypto service
Getting credentials
Getting credentials from native keychain
Getting keychain reference
isKeychainEnabled: true
KeychainCache: undefined
Attempting to load native keychain
Got native keychain reference
Got native keychain reference
Got credentials from native keychain: <hidden>
Credentials found in native keychain
Credentials is chunked. Reading all chunks...
Got all chunks successfully
Credentials: <hidden>
Decrypting credentials
Decrypted credentials: <hidden>
Credentials content: <hidden>
Credentials: <hidden>
Before cache access plugin. Done.
Executing after cache access plugin
Machine ID: <hidden>
Invoking crypto service
Did TokenCacheContext cache changed: false
After cache access plugin. Done.
✔ Successfully logged into Azure!
Selected tenant: 76275315-7a75-*****
Selected subscription: f906b2b8-b243-*****
Project credentials:
 - subscriptionId: f906b2b8-b243-*****
 - tenantId: 76275315-7a75-*****
 - clientId: <undefined>
 - clientSecret: <undefined>
Login successful

Checking project "aaabbccc" settings...
Only one project found. Trying to use it if the name matches...
Static site found!
- staticSite:
  - id: /subscriptions/f906b2b8-b243-*****/resourceGroups/ProjectDemo/providers/Microsoft.Web/staticSites/aaabbccc
  - name: aaabbccc
  - location: Central US
  - type: Microsoft.Web/staticSites
 - tags:
 - sku:
   - name: Free
   - tier: Free
  - defaultHostname: red-island-0b1abb210.2.azurestaticapps.net
  - repositoryUrl:
  - branch:
 - customDomains:
 - privateEndpointConnections:
  - stagingEnvironmentPolicy: Enabled
  - allowConfigFileUpdates: true
  - contentDistributionEndpoint: https://content-dm1.infrastructure.2.azurestaticapps.net
  - keyVaultReferenceIdentity: SystemAssigned
 - userProvidedFunctionApps:
  - provider: None
  - enterpriseGradeCdnStatus: Disabled
Project settings:
 - resourceGroupName: ProjectDemo
 - staticSiteName: aaabbccc
 - subscriptionId: f906b2b8-b243-*****
✔ Successfully setup project!
No swa-cli.config.json file found. Skipping saving project settings.

Deployment token provided via remote configuration
 - deploymentToken: <hidden>

Deploying to environment: production

Trying to read workflow config with values:
 - appLocation: G:\Projects\aa
 - outputLocation: G:\Projects\aa
 - apiLocation: <undefined>
No workflow config folder found at G:\Projects\aa\.github\workflows
Validating user workflow config (BEFORE):
 - appLocation: G:\Projects\aa
 - outputLocation: G:\Projects\aa
 - apiLocation: <undefined>
Validating user workflow config (AFTER):
 - appLocation: G:\Projects\aa
 - apiLocation: <undefined>
 - outputLocation: G:\Projects\aa
No staticwebapp.config.json found in current project
Deploying project to Azure Static Web Apps...
Fetching release metadata for version: stable. Please wait...
 - version: stable
 - buildId: 1.0.020981
 - publishDate: 2022-09-29T17:37:34.4094014Z
- files:
 - linux-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.020981/linux/StaticSitesClient
   - sha: e55db21d0720a12098804559152303e66846bdd94c13a30b30be29a0fc9ae366
 - win-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.020981/windows/StaticSitesClient.exe
   - sha: 4e4eb72aef26641e236c24929c822500e956bda099ca78054112cadf20261107
 - osx-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.020981/macOS/StaticSitesClient
   - sha: e0f2ae7ec297510a1b3b9332c0dc0dd962a51adb8ea13cd4f3746d79fc24a7e9
Local client binary is up to date. Skipping download.
Deploying using C:\Users\user\.swa\deploy\1.0.020981\StaticSitesClient.exe@1.0.020981
Deploying using the following options:
- env:
  - SWA_CLI_DEBUG: silly
  - SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
  - SWA_RUNTIME_CONFIG_LOCATION: <undefined>
  - SWA_RUNTIME_CONFIG: <undefined>
  - SWA_CLI_VERSION: 1.0.3
  - SWA_CLI_DEPLOY_DRY_RUN: false
  - SWA_CLI_DEPLOY_BINARY: C:\Users\user\.swa\deploy\1.0.020981\StaticSitesClient.exe@1.0.020981
  - DEPLOYMENT_ACTION: upload
  - DEPLOYMENT_PROVIDER: SwaCli
  - REPOSITORY_BASE: G:\Projects\aa
  - SKIP_APP_BUILD: true
  - SKIP_API_BUILD: true
  - DEPLOYMENT_TOKEN: <hidden>
  - APP_LOCATION: G:\Projects\aa
  - API_LOCATION: <undefined>
  - CONFIG_FILE_LOCATION: <undefined>
  - VERBOSE: true
ℹ DeploymentId: f55b13d0-93fe-43b7-8f46-de5cb090b5b6
ℹ
ℹ Verbose logging enabled
ℹ Build timeout not specified, defaulting to 15 minutes
ℹ App Directory Location: 'G:\Projects\aa' was found.
ℹ Looking for event info
ℹ Could not get event info. Proceeding
ℹ Skipping step to build G:\Projects\aa with Oryx
ℹ No Api directory specified. Azure Functions will not be created.
ℹ Could not find staticwebapp.config.json file.
ℹ Didn't find Oryx manifest file under location: G:\Projects\aa\ss-oryx\app-manifest\oryx-manifest.toml
ℹ Determined default file to be: index.html
ℹ Either no Api directory was specified, or the specified directory was not found. Azure Functions will not be created.
ℹ Zipping App Artifacts
ℹ App Zip will be created from directory: G:\Projects\aa
ℹ
ℹ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
ℹ If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/

@manekinekko
Copy link
Member

@doggy8088 can you please try again by moving your index.html file under a new folder, for example, public, like so:

public/index.html

Then re-run the command:

swa deploy --verbose=silly --env production --app-name aaabbccc -R ProjectDemo --app-location public

Please note the flag --app-location public

@doggy8088
Copy link
Author

@manekinekko It works. So I can't use . as --app-location. 👍

@sgollapudi77
Copy link
Contributor

Thanks @doggy8088 , we're closing this issue.

@luzdealba
Copy link

(...) it is a known bug as of now and the team is actively working towards enabling deployment from the root folder (...) As an alternative, I'd recommend trying to set up an app-location with the index.html in it and try swa deploy --app-location ... command to see if this works.

Thanks @Reshmi-Sriram! That did it for me.

Sad to see that this "known bug" hasn't been fixed in ~2 years though :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants