swa deploy fails: "Cannot deploy to the function app because Function language info isn't provided" despite providing apiRuntime/flags
Environment:
swa CLI version: 2.0.6 (also reproduced on 2.0.7) OS: macOS Node/npm versions: (optional) Reproduction steps:
Repository layout: app build at: ./build (contains build/staticwebapp.config.json with platform.apiRuntime set to node:16) api folder at: ./api (contains package.json) Commands run: swa deploy --app-name my-first-static-web-app --env production --output-location build --api-location api --api-language node --api-version 16 --verbose=silly Also tried exporting env vars: FUNCTION_LANGUAGE=node FUNCTION_LANGUAGE_VERSION=16 SWA_RUNTIME_CONFIG_LOCATION=$(pwd) Tried with swa CLI v2.0.7 and v2.0.6; reinstall via npm did not help. Tried workarounds: placing staticwebapp.config.json in build, specifying empty api folder, renaming api folder — all attempted. Observed behavior:
Deployment aborts with: "Cannot deploy to the function app because Function language info isn't provided, use flags "--api-language" and "--api-version" or add a "platform.apiRuntime" property..." Verbose log shows FUNCTION_LANGUAGE and FUNCTION_LANGUAGE_VERSION set, build/staticwebapp.config.json contains platform.apiRuntime, and --api-language/--api-version were passed, yet the tool still errors. Example log excerpt: Looking for event info Could not get event info. Proceeding ... Api Directory Location: '/.../api' was found. Skipping step to build .../api with Oryx ✖ Cannot deploy to the function app because Function language info isn't provided... Expected behavior:
Deployment should accept provided api runtime info (from flags, env vars, or staticwebapp.config.json in build) and proceed to upload static files and API (or skip API when explicitly empty). Attachments / config files:
build/staticwebapp.config.json: { "navigationFallback": { "rewrite": "/index.html" }, "platform": { "apiRuntime": { "language": "node", "version": "16" } } } api/package.json (short): { "name": "api", "version": "1.0.0", "scripts": { "start": "func start" }, "dependencies": { "@azure/functions": "^4.0.0" }, "type": "module" } swa-cli.config.json (relevant parts): { "appLocation": ".", "apiLocation": "api", "outputLocation": "build", "apiLanguage": "node", "apiVersion": "16", "apiRuntime": "node:19" } Additional notes:
Workarounds attempted: downgraded swa CLI to 2.0.6, reinstalled, set environment variables, pointed api-location to empty folder, renamed api folder, created build/staticwebapp.config.json. None resolved the error. Logs and env indicate the CLI/wrapper sees FUNCTION_LANGUAGE and FUNCTION_LANGUAGE_VERSION, but the deployment binary still rejects due to missing language info — suggests a bug in how flags/env/config are passed to the StaticSitesClient binary or validated. Request: Please investigate why provided api runtime info is ignored and either fix the CLI/wrapper or provide guidance on the correct way to pass api runtime details so deployment succeeds.