Open scottrudy opened 1 year ago
As of now I just deployed the API to an Azure Function with no changes. I then modified the web page service call to use the Azure Function host name. Works flawlessly, but would be better to have them working in one resource.
Hi @scottrudy have you tried the steps from our documentation here? I guess the dotnet API needs to be built before being deployed.
@manekinekko In looking at this command, the publish step is for the Blazor app, which references the publish folder on the command line.
swa deploy ./Client/bin/Release/net6.0/publish/wwwroot --api-location ./Api
The API portion, which is the second half of the command, just uses the directory for a reference.
@manekinekko I have the exact same issue, using SWA CLI v1.0.3. Here are my log file:
❯ swa deploy -d $swa_key --env default --verbose=silly
Welcome to Azure Static Web Apps CLI (1.0.3)
Getting config file options from swa-cli.config.json...
Changed directory to /workspaces/blazor-wasm-time-series
Using configuration "blazor-wasm-time-series" from file:
/workspaces/blazor-wasm-time-series/swa-cli.config.json
Deploying front-end files from folder:
/workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot
Deploying API from folder:
/workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy
Deployment token provided via flag
- --deployment-token: <hidden>
Deploying to environment: default
Trying to read workflow config with values:
- appLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web
- outputLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot
- apiLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy
No workflow config folder found at /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/.github/workflows
Validating user workflow config (BEFORE):
- appLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web
- outputLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot
- apiLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy
Validating user workflow config (AFTER):
- appLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web
- apiLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy
- outputLocation: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot
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:
/workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/staticwebapp.config.json
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 /home/vscode/.swa/deploy/1.0.020981/StaticSitesClient@1.0.020981
Deploying using the following options:
- env:
- SWA_CLI_DEBUG: silly
- SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
- SWA_RUNTIME_CONFIG_LOCATION: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web
- SWA_RUNTIME_CONFIG: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/staticwebapp.config.json
- SWA_CLI_VERSION: 1.0.3
- SWA_CLI_DEPLOY_DRY_RUN: false
- SWA_CLI_DEPLOY_BINARY: /home/vscode/.swa/deploy/1.0.020981/StaticSitesClient@1.0.020981
- DEPLOYMENT_ACTION: upload
- DEPLOYMENT_PROVIDER: SwaCli
- REPOSITORY_BASE: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web
- SKIP_APP_BUILD: true
- SKIP_API_BUILD: true
- DEPLOYMENT_TOKEN: <hidden>
- APP_LOCATION: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot
- API_LOCATION: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy
- CONFIG_FILE_LOCATION: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web
- VERBOSE: true
- DEPLOYMENT_ENVIRONMENT: default
ℹ DeploymentId: 810de18d-b6e7-4ca5-986a-65a49a634128
ℹ
ℹ Verbose logging enabled
ℹ Build timeout not specified, defaulting to 15 minutes
ℹ App Directory Location: '/workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot' was found.
ℹ config_file_location: config file '/workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/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 /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot with Oryx
ℹ Api Directory Location: '/workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy' was found.
ℹ Didn't find Oryx manifest file under location: /workspaces/blazor-wasm-time-series/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.
ℹ Copying 'staticwebapp.config.json' to build output
ℹ Skipping step to build /workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy with Oryx
ℹ Function Runtime Information. OS: windows, Functions Runtime: ~4, dotnet version: 6.0
ℹ Zipping Api Artifacts
ℹ Api Zip will be created from directory: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Proxy
ℹ Api Content Hash: ca391616580c35e88608ddcf11c9af77
ℹ Done Zipping Api Artifacts
ℹ Zipping App Artifacts
ℹ App Zip will be created from directory: /workspaces/blazor-wasm-time-series/src/WaterConsumption.Web/wwwroot
ℹ Done Zipping App Artifacts
ℹ Uploading build artifacts.
ℹ Finished Upload. Polling on deployment.
ℹ Status: InProgress. Time: 0.1892429(s)
ℹ Status: InProgress. Time: 15.457412(s)
ℹ Status: Succeeded. Time: 30.6338286(s)
ℹ Deployment Complete :)
ℹ Thanks for using Azure Static Web Apps!
✔ Project deployed to https://brave-mud-0b19c941e.2.azurestaticapps.net 🚀
And here's my repo: https://github.com/justinyoo/blazor-wasm-time-series
I can deploy the same code without changes through VS Code's right-click publish. What I identified was that, if I use the SWA CLI, the managed API doesn't show up:
On the other hand, if I use VS Code's right-click publish, it shows the managed backend API:
The main difference between the right-click publish and swa deploy
is that the right-click publish is using GitHub Actions for deploy.
It appears the swa deploy
command is sending the entire .net project rather than the actual compiled binaries produced by dotnet publish
which works on other runtimes but not for .Net.
For me, the following worked (.net 6 isolated api project + blazor wasm UI with all default settings):
swa build
swa deploy -i api\bin\Release\net6.0\publish
Btw this actually appears to be tightly related to #510
I just ran into this issue now and can confirm @ofcoursedude's solution worked great for me.
It appears the
swa deploy
command is sending the entire .net project rather than the actual compiled binaries produced bydotnet publish
which works on other runtimes but not for .Net. For me, the following worked (.net 6 isolated api project + blazor wasm UI with all default settings):swa build swa deploy -i api\bin\Release\net6.0\publish
any one know a WHY here., it is super frustrating to me as the managed API link just briefly shown and gone again... something looks not right I feel.
Even at version 1.1.2 this is still an issue, I've use BYOF up until today and trying to get it deploy was very frustrating until coming across this thread!
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
?--port
) and accessing the CLI from that port:4280
ℹ️ NOTE: Make sure to enable debug logs when running any
swa
commands using--verbose=silly
Describe the bug My application is using parcel to generate static web files backed by a dotnet 6 HTTP function, which works fine using
swa start
locally. When usingswa deploy
the API is not found. It does not appear in the API section of the resource in Azure's portal and calls from the UI result in a 404. The project is using anapi
directory off the root of the project. The zip files are generated and deployed for the static app and the API.Note that on the portal Overview blade it does show Function errors, but does not indicate any Function hits. The Application Insights blade also shows the warning message, "App Insights is only applicable to Static Web Apps with at least one function. Add a function to your app to enable App Insights."
To Reproduce Steps to reproduce the behavior:
Expected behavior I'm expecting to see the call to the API succeed. In addition, I expect to see the API show up in the API section of the resource on the Azure Portal.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context