Azure / Azure/azure-functions-core-tools

Nozip flag ignored

Open
#3,352 4 comments 0 reactions 0 assignees View on GitHub
area: publish bug confirmed good first issue
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

I'm developing Azure Function App and I have to run it **no from the package** because I need to write temporary file to file system.

I've tried all automatic deployment methods known to me, vs code Azure Function deployment, `azure functionapp publish` with and without `--nozip` flag, and Git Action deployment.

None of the methods seem to deploy to `d:\home\site\wwwroot`

vs code Azure Function deployment UI does not even ask, ands and sets `WEBSITE_RUN_FROM_PACKAGE` to `1`.

`func azure functionapp publish textjoint-api --nozip` does not do anything about the flag, reports successful deployment, reports success and leaves the files in `C:\home\data\SitePackages` without moving them to `d:\home\site\wwwroot`

```
PS C:\Projects\textjoint-api> func azure functionapp publish textjoint-api --nozip
Getting site publishing info...
Creating archive for current directory...
Uploading 101.77 MB [#############################################################################]
Upload completed successfully.
Functions in textjoint-api:
upload - [httpTrigger]
Invoke url: https://textjoint-api.azurewebsites.net/api/upload

```

An this is true for no matter if `WEBSITE_RUN_FROM_PACKAGE` exists or set to `1` or `zero`

Same with Github Action deployment.

Also noticed that when I flip (or remove) `WEBSITE_RUN_FROM_PACKAGE` and look at the files view Azure portal or VS Code, I see different version, of the source code, which is probably expected. Proofs that the flag works.

Another observation, Logs in Deployment center show the following:

```
Updating submodules.
Preparing deployment for commit id 'c07e2304a0'.
Skipping build. Project type: Run-From-Zip
Skipping post build. Project type: Run-From-Zip
Triggering recycle (preview mode disabled).
Deployment successful.
```

Notice `Project type: Run-From-Zip` which is not what I would expect with `--nozip` flag.

**Context:**
Windows Azure Function App / Consumption plan.
Runtime version: 4.19.0.20414
Location: Germany West Central
Node ~18

`setting.json` (afaik affects vs code azure plugin behavior)
```
{
"azureFunctions.projectLanguage": "TypeScript",
"azureFunctions.projectRuntime": "~4",
"azureFunctions.validateFuncCoreTools": true,
"azureFunctions.defaultFunctionAppToDeploy": "textjoint-api",
"azureFunctions.showDeployConfirmation": false,
"azurite.debug": true,
"debug.internalConsoleOptions": "neverOpen",

}
````
`az --version`:
```
az --version
azure-cli 2.48.1

core 2.48.1
telemetry 1.0.8

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
```

For testing created new Function App: 'textjoint-fresh-api'
- Removed `WEBSITE_RUN_FROM_PACKAGE`
- Set ` AzureWebJobsFeatureFlags` to `EnableWorkerIndexing`
- Deploying from the same codebase using `func azure functionapp publish textjoint-fresh-api --nozip`

First run:
```
Getting site publishing info...
Creating archive for current directory...
Uploading 101.77 MB [#############################################################################]
Creating archive for current directory...
Uploading 101.77 MB [#############################################################################]
Creating archive for current directory...
Uploading 101.77 MB [#############################################################################]
Error uploading archive (Conflict).
**Server Response: The 'Preparing zip package' operation conflicts with the pending 'Performing continuous deployment' operation started at 2023-04-27T18:44:47.2095770Z. Please retry operation later.**
PS C:\Projects\textjoint-api>
```

Log entry in Azure Portal Deployment Center:
```

Updating submodules.
Preparing deployment for commit id '31bfd81f17'.
Generating deployment script.
> Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r >"C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --basic --sitePath "C:\local\Temp\zipdeploy\extracted"'.
Running deployment command...
Running post deployment command(s)...
Command: "C:\home\site\deployments\tools\deploy.cmd"
>Handling Basic Web Site deployment.
>Creating app_offline.htm
>KuduSync.NET from: 'C:\local\Temp\zipdeploy\extracted' to: 'C:\home\site\wwwroot'
>[list of files]

Triggering recycle (preview mode disabled).
Deployment successful.

```

All right, files are in place, confirmed via kudu, but the function is not discovered, not listed under functions in Azure Portal. `"main": "dist/functions/*.js"` in `package.json` present. Problem for another day.

Content of `C:\home\site\deployments\tools\` for both is identical.
`c:\home\LogFiles\eventlog.xml'
screams about `Failed to open siteversion.txt. ZipFS setup failed. Error: 0x80070003` and `Failed to copy zip from remote source.`.

My apologies for long-winded description, that was long-winded attempt to get anything work.

What should I check and try next?

BTW: it took me another day to understand that the flag is ignored. Because they you start to talk to `fs` from package deployment function fails silently without any indication of the problem, and logs are are inconsistent probably because to they are not flushed on time. Took me ages to zero in exact problem. Not ideal.

Contributor guide

Open the contributing guide

Research direction

Reproduce `func azure functionapp publish textjoint-api --nozip` and compare its deployment output with the Azure Deployment Center logs. Start by tracing how the publish command handles `--nozip`, `WEBSITE_RUN_FROM_PACKAGE`, and the Kudu deployment path described in the report. Done means the flag's behavior is corrected or clearly documented, with the reported deployment mode and resulting files matching expectations.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, node.js, typescript
Domain
cli, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.