Closed TwonkyTheRobot closed 1 year ago
Thanks for opening this issue! Adding @pauld-msft who is looking into customer issues this week. @pauld-msft At first sight I couldn't find what is the cause of the issue. Looking at https://github.com/microsoft/Oryx/blob/main/src/BuildScriptGenerator/Node/NodeBashBuildSnippet.sh.tpl line 195, this seems like a part of the code we didn't update recently (even though SWA might not be up to date with their version).
@TwonkyTheRobot By any chance, is this application public so that we can try to reproduce and determine what goes wrong? If not, could you please share if you're using anything specific in your package.json when building your app?
The change does not have to be that recent. It seems the last build before now was Jun 16, 2022. So any change between whatever was used then and 0.2.20230501.1 (that is used according to the log) could have caused it.
The source code is unfortunately not public, but I can share the package.json:
"name": "web-disturbance-admin",
"version": "0.0.0",
"scripts": {
"dev": "vite --port 8080",
"dev:bypass": "vite --mode bypass",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"@geoman-io/leaflet-geoman-free": "^2.10.0",
"@headlessui/vue": "^1.4.1",
"@meforma/vue-toaster": "^1.2.2",
"@popperjs/core": "^2.9.2",
"@turf/centroid": "^6.3.0",
"@turf/kinks": "^6.5.0",
"@types/leaflet": "^1.7.0",
"@vuelidate/core": "^2.0.0-alpha.25",
"@vuelidate/validators": "^2.0.0-alpha.21",
"axios": "^0.21.4",
"date-fns": "^2.21.2",
"leaflet": "^1.7.1",
"vue": "^3.2.6",
"vue-router": "^4.0.11",
"vue3-markdown-it": "^1.0.8",
"vuex": "^4.0.2",
"vuex-persistedstate": "^4.0.0"
},
"devDependencies": {
"@iconify/json": "^1.1.396",
"@types/lodash": "^4.14.173",
"@types/node": "^15.0.2",
"@vitejs/plugin-vue": "^1.6.0",
"@vue/compiler-sfc": "^3.2.6",
"@vuedx/typecheck": "^0.6.0",
"@vuedx/typescript-plugin-vue": "^0.6.0",
"typescript": "^4.1.3",
"vite": "^2.5.3",
"vite-plugin-components": "^0.8.4",
"vite-plugin-icons": "^0.5.1",
"vite-plugin-pwa": "^0.11.2",
"vite-plugin-windicss": "^1.4.3",
"windicss": "^3.1.7"
}
}
Hi, I am facing a similar issue. as I have multiple deploys per day I was able to identify that the issue started between 02/05 and 04/05. I will add both last success and first failed, hopefully this will help to identify the issue.
I am using this from Azure DevOps, it seems that usually this is executed from GitHub, not sure if this will have any impact. This is not a public repo, but there is no big secrets into it so maybe I can give more details if necessary.
--- Last success execution ---- Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx You can report issues at https://github.com/Microsoft/Oryx/issues
Oryx Version: 0.2.20221103.1, Commit: a2c65dde152b749fea395f4d1242ea9350942258, ReleaseTagName: 20221103.1
Build Operation ID: |YJQFS9Di274=.f121b650_ Repository Commit : b55821ac67ef0b721c5c8a5784ad7a8ab679b831
Detecting platforms... Detected following platforms: nodejs: 18.16.0 Version '18.16.0' of platform 'nodejs' is not installed. Generating script to install it...
Source directory : /working_dir/api Destination directory: /7e388fa7-0ed2-40d7-ba37-772ff293f399-swa-oryx/api
Downloading and extracting 'nodejs' version '18.16.0' to '/opt/nodejs/18.16.0'... Detected image debian flavor: bullseye. Downloaded in 1 sec(s). Verifying checksum... Extracting contents... performing sha512 checksum for: nodejs... Done in 2 sec(s).
Removing existing manifest file Creating directory for command manifest file if it does not exist Creating a manifest file... Node Build Command Manifest file created.
Using Node version: v18.16.0
Using Npm version: 9.5.1
Installing production dependencies in '/working_dir/api/.oryx_prod_node_modules'...
Running 'npm install --unsafe-perm --production'...
npm WARN config production Use --omit=dev
instead.
added 4 packages, and audited 5 packages in 334ms
found 0 vulnerabilities
Copying production dependencies from '/working_dir/api/.oryx_prod_node_modules' to '/working_dir/api/node_modules'... Done in 0 sec(s).
Running 'npm install --unsafe-perm'...
up to date, audited 5 packages in 330ms
found 0 vulnerabilities --- Last success execution ----
And this is the first one that failed:
--- First execution with error --- Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx You can report issues at https://github.com/Microsoft/Oryx/issues
Oryx Version: 0.2.20230501.1, Commit: 58513374525ab2977af68fc5b3c344d32858d8af, ReleaseTagName: 20230501.1
Build Operation ID: e0fac17cb99ebacf OS Type : bullseye Image Type : jamstack
Detecting platforms... Detected following platforms: nodejs: 18.16.0 Version '18.16.0' of platform 'nodejs' is not installed. Generating script to install it...
Source directory : /working_dir/api Destination directory: /308cb20f-75ac-4cb5-9a3d-bd4eb4d0ca3a-swa-oryx/api
Installing common platform dependencies... Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB] Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB] Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB] Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB] Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [237 kB] Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB] Fetched 8643 kB in 1s (6393 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Building dependency tree... Reading state information... git is already the newest version (1:2.30.2-1+deb11u2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Downloading and extracting 'nodejs' version '18.16.0' to '/opt/nodejs/18.16.0'... Detected image debian flavor: bullseye. Downloaded in 0 sec(s). Verifying checksum... Extracting contents... performing sha512 checksum for: nodejs... Done in 2 sec(s).
Removing existing manifest file Creating directory for command manifest file if it does not exist Creating a manifest file... Node Build Command Manifest file created.
Using Node version: v18.16.0
Using Npm version: 9.5.1 /tmp/BuildScriptGenerator/94d3d2f7cb0c4da68cc33d2c8a9f3917/build.sh: line 340: [: missing `]' /tmp/BuildScriptGenerator/94d3d2f7cb0c4da68cc33d2c8a9f3917/build.sh: line 340: IsNotBlank: command not found
Installing production dependencies in '/working_dir/api/.oryx_prod_node_modules'...
Running 'npm install --production'...
npm WARN config production Use --omit=dev
instead.
added 4 packages, and audited 5 packages in 384ms
found 0 vulnerabilities
Copying production dependencies from '/working_dir/api/.oryx_prod_node_modules' to '/working_dir/api/node_modules'... Done in 0 sec(s).
Running 'npm install'...
up to date, audited 5 packages in 326ms
found 0 vulnerabilities --- First execution with error ---
Hi all, thanks for reporting! I've put out a PR to fix this issue with IsNotBlank: command not found
: https://github.com/microsoft/Oryx/pull/1987
That being said, I'm not sure that these errors would necessarily be causing the Oryx build to fail. It still seems to run npm install
, and I don't see any other errors from the Oryx side. This theory seems to be corroborated by the examples that @peruzzof provided, as the successful and failed logs both have the exact same oryx version 20230501.1
and both contain the errors mentioned above.
Do you see any potential problems in the other logs, such as after the Oryx build has completed, that could indicate an issue?
My bad, I pasted the wrong as success execution, I just edited my original post to adjust it. The execution used the version "Oryx Version: 0.2.20221103.1" that looks quite old but, probably, was the version with the tag "stable" (used by the Azure DevOps task), and there is no option to select anything different.
@peruzzof thanks for the update. That makes sense, it generally takes some time for our partners to rollout updates that we are able to implement.
Would you be able to share exactly how the build is breaking? I was able to reproduce the issue with a simple react app / api, where the app build works fine but the api build shows the errors. That being said, the build / deployment still succeeded and deployed, and I confirmed that the api still works.
https://github.com/pauld-msft/my-first-static-web-app-react/actions/runs/4928028942/jobs/8805853570
New theory; could it be that the managed API gets built as a v4.0 functions app now? The site uses proxies.json for the API, and that isn't supported by v4, so that could explain the 404. On the other hand, our hosts.json says:
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
}
}
In my case I am using the API to map userRules based in the AD groups. Some users complained that it wasn't working then I noticed the error. Running the pipeline with the previous versions solved the issue.
At the moment, as a workaround, I replaced the task "AzureStaticWebpApp@0" with a similar bash task that will use the docker image "mcr.microsoft.com/appsvc/staticappsclient:prev" to deploy.
I can ask if I am able to break the environment again to get some logs, let me know if this is important.
@TwonkyTheRobot - that sounds like a good theory. Like I mentioned previously, I'm not sure that the IsNotBlank: command not found
error would break deployments, but rather is likely a red herring.
@peruzzof - is there any indication in the deployment of the API itself that there could be an issue? Are you also hosting your API in Azure Functions and if so, was your api also upgrade to v4 Azure Function App?
My workaround was to create a separate Azure Function and use that instead of the managed API. This allowed me to set AzureWebJobsFeatureFlags to EnableProxies, and be able to use the proxies.json in a v4 app. (I could also have set the version to v2 or v3). So now the Static Web app works again.
Closing this issue as the error that oryx generated was fixed, and the root of the issue seems to be with the new v4 azure function apps. There will likely be a delay in seeing the fix in production app service since our partners have fairly long release cycle, but from our side this is resolved. Feel free to re-open or open a new issue if there are other indications that Oryx is the root cause.
Bug Report
A couple of days ago we made a new build for an Azure Static Web app. This app hasn't been built for a year or so, and no real changes were made (it was an added Dependabot config file that caused the build.) Since that build calls to the backend (an Azure Functions proxy) give 404.
The site is built and deployed with a Github action using Azure/static-web-apps-deploy@v1
Looking at the build logs I see these lines when the API is built:
/tmp/BuildScriptGenerator/7b94a6a078de44b4a2d4cb12e2342395/build.sh: line 195: IsNotBlank: command not found /tmp/BuildScriptGenerator/7b94a6a078de44b4a2d4cb12e2342395/build.sh: line 195: [: missing `]'
Something seems to go wrong with the backend build, but the deploy continues anyway.
I've tried different node versions, but the thing that I cannot change (I think) is the version of Oryx, which was obviously different at the time of the last build that worked.
Does anyone have an idea on how to fix it?