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

Swa deploy fails with an unknown exception has occurred #531

Closed
joebell1329 opened this issue Jul 1, 2022 · 6 comments
Closed

Swa deploy fails with an unknown exception has occurred #531

joebell1329 opened this issue Jul 1, 2022 · 6 comments
Assignees
Labels
command: deploy All issues related to the deploy command status: investigating The team is investigating the issues type: bug Something isn't working

Comments

@joebell1329
Copy link

joebell1329 commented Jul 1, 2022

Describe the bug
When running swa deploy to deploy a frontend app without an API, it fails with the error "An unknown exception has occurred"

To Reproduce

  1. Configure the following environment variables;
  • AZURE_REGION_LOCATION
  • AZURE_RESOURCE_GROUP
  • AZURE_SUBSCRIPTION_ID
  • SWA_CLI_APP_NAME
  • SWA_CLI_DEPLOYMENT_TOKEN
  1. Type in command 'swa deploy'

Expected behaviour
The app is deployed to the configured location.

Verbose Log


Welcome to Azure Static Web Apps CLI (1.0.2)

Getting config file options from swa-cli.config.json...
Config file does not exist at C:\Users\Joe\Development\external\dist\swa-cli.config.json
Deploying front-end files from folder:
  C:\Users\Joe\Development\external\dist

Deployment token found in Environment Variables:
 - SWA_CLI_DEPLOYMENT_TOKEN: <hidden>

Deploying to environment: preview

Trying to read workflow config with values:
 - appLocation: C:\Users\Joe\Development\external\dist
 - outputLocation: C:\Users\Joe\Development\external\dist
 - apiLocation: <undefined>
No workflow config folder found at C:\Users\Joe\Development\external\dist\.github\workflows
Validating user workflow config (BEFORE):
 - appLocation: C:\Users\Joe\Development\external\dist
 - outputLocation: C:\Users\Joe\Development\external\dist
 - apiLocation: <undefined>
Validating user workflow config (AFTER):
 - appLocation: C:\Users\Joe\Development\external\dist
 - apiLocation: <undefined>
 - outputLocation: C:\Users\Joe\Development\external\dist
Loading staticwebapp.config.json schema...
Schema loaded successfully from https://json.schemastore.org/staticwebapp.config.json
Compiling schema...
Reading content from staticwebapp.config.json...
Parsing staticwebapp.config.json...
Validating staticwebapp.config.json...
File validated successfully. Continuing with configuration!
Content parsed successfully

Found configuration file:
  C:\Users\Joe\Development\external\dist\staticwebapp.config.json

Deploying project to Azure Static Web Apps...
Fetching release metadata for version: stable. Please wait...
 - version: stable
 - buildId: 1.0.019361
 - publishDate: 2022-04-20T15:35:50.4947355Z
- files:
 - linux-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/linux/StaticSitesClient
   - sha: 24baa1cedd45b7b029f3ee502265de940383fab940e0bed75842cbf7f9030080
 - win-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/windows/StaticSitesClient.exe
   - sha: 66c529754df158761523aeffcc5f278d14205f6b51afec913ba113edc3caa681
 - osx-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/macOS/StaticSitesClient
   - sha: ec26ca4e7a12f46cee93b5d0b2128f79f18a3ff9875d7276a837ca94c16be854
Local client binary is up to date. Skipping download.
Deploying using C:\Users\Joe\.swa\deploy\1.0.019361\StaticSitesClient.exe@1.0.019361
Deploying using the following options:
- env:
  - SWA_CLI_DEBUG: silly
  - SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
  - SWA_RUNTIME_CONFIG_LOCATION: C:\Users\Joe\Development\external\dist
  - SWA_RUNTIME_CONFIG: C:\Users\Joe\Development\external\dist\staticwebapp.config.json
  - SWA_CLI_VERSION: 1.0.2
  - SWA_CLI_DEPLOY_DRY_RUN: false
  - SWA_CLI_DEPLOY_BINARY: C:\Users\Joe\.swa\deploy\1.0.019361\StaticSitesClient.exe@1.0.019361
  - DEPLOYMENT_ACTION: upload
  - DEPLOYMENT_PROVIDER: swa-cli-1.0.2
  - REPOSITORY_BASE: C:\Users\Joe\Development\external\dist
  - SKIP_APP_BUILD: true
  - SKIP_API_BUILD: true
  - DEPLOYMENT_TOKEN: <hidden>
  - APP_LOCATION: C:\Users\Joe\Development\external\dist
  - API_LOCATION: <undefined>
  - CONFIG_FILE_LOCATION: C:\Users\Joe\Development\external\dist
  - VERBOSE: true
  - DEPLOYMENT_ENVIRONMENT: preview
ℹ DeploymentId: da6fb4cc-1baf-4ba2-b72c-698a2a43d1b3
ℹ
ℹ Verbose logging enabled
ℹ Build timeout not specified, defaulting to 15 minutes
ℹ App Directory Location: 'C:\Users\Joe\Development\external\dist' was found.
ℹ No Api directory specified. Azure Functions will not be created.
ℹ config_file_location: config file 'C:\Users\Joe\Development\external\dist\staticwebapp.config.json' was found.
ℹ Looking for event info
ℹ Event info parsed from action options.
ℹ Could not get repository branch. Proceeding
ℹ Could not get repository url. Proceeding
ℹ Skipping step to build C:\Users\Joe\Development\external\dist with Oryx
ℹ Didn't find Oryx manifest file under location: C:\Users\Joe\Development\external\dist\ss-oryx\app-manifest\oryx-manifest.toml
ℹ Determined default file to be: index.html
ℹ Using 'staticwebapp.config.json' file for configuration information, 'routes.json' will be ignored.
ℹ 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: C:\Users\Joe\Development\external\dist
✖ An unknown exception has occurred
ℹ
ℹ 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/

Desktop (please complete the following information):

  • OS: Windows
  • Version 11
@Reshmi-Sriram
Copy link
Contributor

Hey @joebell1329 ,

Have you tried following the steps mentioned in the official doc here?
Our recommendation for running applications without an api is to first build it and then try the swa deploy <build folder>

Let us know if this works fine in your case?

@joebell1329
Copy link
Author

joebell1329 commented Jul 1, 2022

Hi @Reshmi-Sriram,

The app is already built and I am running the swa deploy command from within the build output folder (which, in this case, is C:\Users\Joe\Development\external\dist)

Apologies I didn't mention that in the steps to reproduce.

@Reshmi-Sriram
Copy link
Contributor

Got it! Thanks for clarifying, we will investigate this further!
Meanwhile could you please confirm if swa deploy ./dist (Option 2 in the doc) does not work either??

Also, much appreciated if you could share your project (without sensitive content) so that we could try reproducing it on our ends. Sorry for the experience!

@Reshmi-Sriram Reshmi-Sriram added type: bug Something isn't working status: investigating The team is investigating the issues command: deploy All issues related to the deploy command labels Jul 1, 2022
@AGJacobDixon
Copy link

I was having the same problem and moving up a working directory did work as a work around for me.

Thank you

@joebell1329
Copy link
Author

joebell1329 commented Jul 1, 2022

Yep, moving to the parent directory and running swa deploy ./dist worked for me too. Thanks!

p.s. I'm afraid I'm not able to share the project, but it is a build of an Angular 13 app.

@Reshmi-Sriram
Copy link
Contributor

Thanks for the confirmation! Looks like there is a bug, related to #514
Closing this issue and continuing the bug fix in the other issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command: deploy All issues related to the deploy command status: investigating The team is investigating the issues type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants