question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitLab CI/CD deployment with SWA does not execute properly

See original GitHub issue

SWA Version: 1.0.2

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

Describe the bug Installing SWA and deploying through gitlab-ci with node:lts-bullseye-slim image gets to - Preparing deployment. Please wait... and then just finishes without any errors, and the code is not deployed.

gitlab-ci.yml

variables:
  API_TOKEN: "$DEPLOYMENT_TOKEN"

deploy:
  stage: deploy
  image: node:lts-bullseye-slim
  script:
    - npm ci
    - npm run build
    - npm install -g @azure/static-web-apps-cli
    - swa deploy --verbose=silly ./dist -d $API_TOKEN -w ./ --env production
    - echo "Done"

Output with --verbose=silly

Running with gitlab-runner 15.2.0~beta.17.g34ae4a68 (34ae4a68)
  on blue-5.shared.runners-manager.gitlab.com/default -AzERasQ
Preparing the "docker+machine" executor
Using Docker executor with image node:lts-bullseye-slim ...
Pulling docker image node:lts-bullseye-slim ...
Using docker image sha[2](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L2)56:e90[3](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L3)385156c7[4](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L4)30b[5](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L5)f22d19[6](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L6)49f1e5a4002edefbd7af55ad7e8cfb4dee682292 for node:lts-bullseye-slim with digest node@sha256:022657c913284c97ef636b40a3212e035db94e640a37b10cbf5c4da592499b6d ...
Preparing environment
00:02
Running on runner--azerasq-project-12218079-concurrent-0 via runner-azerasq-shared-1657358274-bd4ef00a...
Getting source from Git repository
00:02
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes...
Initialized empty Git repository in /builds/investlab-ab/investlab-app/.git/
Created fresh repository.
Checking out ca193af2 as azure-static...
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:e903385156c7430b5f22d19649f1e5a4002edefbd7af55ad7e8cfb4dee682292 for node:lts-bullseye-slim with digest node@sha256:022657c913284c97ef636b40a3212e035db94e640a37b10cbf5c4da592499b6d ...
$ npm ci
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.[7](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L7) || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated flag-icon-css@3.4.6: The project has been renamed to flag-icons
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V[8](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L8) engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.11: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
added 1767 packages, and audited 1768 packages in 2m
162 packages are looking for funding
  run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues possible (including breaking changes), run:
  npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
$ npm run build
> investlab-app@1.11.0 build
> vue-cli-service build
All browser targets in the browserslist configuration have supported ES module.
Therefore we don't build two separate bundles for differential loading.
-  Building for production...
 WARNING  Compiled with 3 warnings11:20:55 AM
 warning  
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  img/do.f0cade30.svg (385 KiB)
  img/do.3[9](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L9)c495d3.svg (382 KiB)
  js/chunk-vendors.cd5f0fc6.js (783 KiB)
 warning  
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  app (1.02 MiB)
      css/chunk-vendors.4b85a256.css
      js/chunk-vendors.cd5f0fc6.js
      css/app.59bd4a21.css
      js/app.869ce677.js
 warning  
webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
  File                                   Size              Gzipped
  dist/js/chunk-vendors.cd5f0fc6.js      783.39 KiB        235.43 KiB
  dist/js/app.869ce677.js                47.33 KiB         13.71 KiB
  dist/css/chunk-vendors.4b85a256.css    164.79 KiB        28.82 KiB
  dist/css/app.59bd4a21.css              44.48 KiB         5.70 KiB
  Images and other types of assets omitted.
  Build at: 2022-07-09T09:20:55.179Z - Hash: 5fddb3eae3b9d3aa - Time: 24473ms
 DONE  Build complete. The dist directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
       
$ npm install -g @azure/static-web-apps-cli
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
added 352 packages, and audited 353 packages in 28s
40 packages are looking for funding
  run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
  npm audit fix --force
Run `npm audit` for details.
$ swa deploy --verbose=silly ./dist -d $API_TOKEN -w ./ --env production
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 /builds/investlab-ab/investlab-app/swa-cli.config.json
Deploying front-end files from folder:
  /builds/investlab-ab/investlab-app/dist
Deployment token provided via flag
 - --deployment-token: <hidden>
Deploying to environment: production
Trying to read workflow config with values:
 - appLocation: /builds/investlab-ab/investlab-app
 - outputLocation: /builds/investlab-ab/investlab-app/dist
 - apiLocation: <undefined>
No workflow config folder found at /builds/investlab-ab/investlab-app/.github/workflows
Validating user workflow config (BEFORE):
 - appLocation: /builds/investlab-ab/investlab-app
 - outputLocation: /builds/investlab-ab/investlab-app/dist
 - apiLocation: <undefined>
Validating user workflow config (AFTER):
 - appLocation: /builds/investlab-ab/investlab-app
 - apiLocation: <undefined>
 - outputLocation: /builds/investlab-ab/investlab-app/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:
  /builds/investlab-ab/investlab-app/staticwebapp.config.json
Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
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: 66c529754df158761523aeffcc5f278d14205f6b51afec913ba[11](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L11)3edc3caa681
 - osx-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/macOS/StaticSitesClient
   - sha: ec26ca4e7a[12](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L12)f46cee93b5d0b2128f79f18a3ff9875d7276a837ca94c[16](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L16)be854
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.0[19](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L19)361/linux/StaticSitesClient@1.0.019361
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.019361/linux/StaticSitesClient@1.0.019361
Checksum match: 24baa1cedd45b7b029f3ee50[22](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L22)65de940383fab940e0bed75842cbf7f90[30](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L30)080
Saved binary to /root/.swa/deploy/1.0.019[36](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L36)1/StaticSitesClient
Saved metadata to /root/.swa/deploy/StaticSitesClient.json
Deploying using /root/.swa/deploy/1.0.0193[61](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L61)/StaticSitesClient@1.0.01[93](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L93)61
Deploying using the following options:
- env:
  - SWA_CLI_DEBUG: silly
  - SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
  - SWA_RUNTIME_CONFIG_LOCATION: /builds/investlab-ab/investlab-app
  - SWA_RUNTIME_CONFIG: /builds/investlab-ab/investlab-app/staticwebapp.config.json
  - SWA_CLI_VERSION: 1.0.2
  - SWA_CLI_DEPLOY_DRY_RUN: false
  - SWA_CLI_DEPLOY_BINARY: /root/.swa/deploy/1.0.019361/StaticSitesClient@1.0.019361
  - DEPLOYMENT_ACTION: upload
  - DEPLOYMENT_PROVIDER: swa-cli-1.0.2
  - REPOSITORY_BASE: /builds/investlab-ab/investlab-app
  - SKIP_APP_BUILD: true
  - SKIP_API_BUILD: true
  - DEPLOYMENT_TOKEN: <hidden>
  - APP_LOCATION: /builds/investlab-ab/investlab-app/dist
  - API_LOCATION: <undefined>
  - CONFIG_FILE_LOCATION: /builds/investlab-ab/investlab-app
  - VERBOSE: true
- Preparing deployment. Please wait...
$ echo "Done"
Done
Cleaning up project directory and file based variables
00:01
Job succeeded

To Reproduce Set up a project with the above specified gitlab-ci.yml and run the pipeline.

Expected behavior Expected process to complete and deploy the code.

EDIT / UPDATE The issue is only present on -slim distros. (alpine does not work, but that produces a real error so it’s more clear)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jeremylcartercommented, Nov 8, 2022

Okey, so I tried node:lts-bullseye-slim, node:lts-buster and node:lts-bullseye and the unexpected behavior only occurs on -slim distros. Not sure why, but it works fine on both regular bullseye and buster.

Thanks for this! I was using slim and this caught me out.

1reaction
yuriyostapenkocommented, Jul 14, 2022

I’ve just encountered another problem, which manifested the same way, though.

Generally, there is a bug with how JS wrapper spawns native binary and hides underlying errors, so it is difficult to see what exactly is going on. Interestingly, process only exits immediately after “Preparing deployment. Please wait…” in non-interactive mode, while in interactive mode it will just keep spinning forever.

@Tyngstast, as for the actual problem you have with -slim images, I believe the hidden error can be fixed by setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT to 1 before call to swa.

My own problem, if anyone is interested, though, was that the native binary that swa downloads is x64, so does not work inside arm image. Looks like there is currently no mention of platform architecture dependence in the docs.

And with -alpine the problem is due to musl use, but I’m surprised @Tyngstast got a real error, as I observe exactly the same behavior as with any other binary compat problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting CI/CD - GitLab Docs
“A CI/CD pipeline must run and be successful before merge” message. This message is shown if the Pipelines must succeed setting is enabled...
Read more >
How To Set Up a Continuous Deployment Pipeline with ...
The final step in your pipeline is to log in to your server, pull the latest Docker image, remove the old container, and...
Read more >
Introduction to GitLab's CI/CD for Continuous Deployments
In order to set up GitLab's CI/CD tools, you need a project in which to implement them. For this tutorial, you need the...
Read more >
GitLab CI/CD Triggers Simplified 101 - Learn - Hevo Data
GitLab CI /CD pipelines, by default, are executed automatically when new commits are pushed to a repository and do not require any intervention ......
Read more >
Learn the Ins-and-Outs of Gitlab CI for DevOps
Why not use GitLab for CI/CD pipelines? ... When the build job is executed successfully, you'll see the following output showing two green ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found