Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish-BcContainerApp raise error: Timeout downloading file #3562

Open
fridrichovsky opened this issue May 30, 2024 · 3 comments
Open

Publish-BcContainerApp raise error: Timeout downloading file #3562

fridrichovsky opened this issue May 30, 2024 · 3 comments
Assignees

Comments

@fridrichovsky
Copy link
Contributor

Please help me with my error message. When I publish runtime package, I get error "Timeout downloading file". It happens when I am on VPN or somehow have slow download. When I have good connection I do not get mentioned error.

I tried find reason why it happens.

Function "Publish-BcContainerApp" call "Sort-AppFilesByDependencies".

Function "Sort-AppFilesByDependencies" sort files and need extract information from them. Runtime packages are extracted by "Get-AppJsonFromAppFile". Now follow these functions "Get-AppJsonFromAppFile" --> "RunAlTool" --> "DownloadLatestAlLanguageExtension" --> "Download-File" --> "DownloadFileLow"

"Download-File" and "DownloadFileLow" have parameter $timeout, but other functions don't have this parameter. "Download-File" preset this parameter by "$bccontainerHelperConfig.defaultDownloadTimeout". Problem is that preset value is small.

First question is, Is it possible set parameter "$bccontainerHelperConfig.defaultDownloadTimeout" from script?

I tried use switch "excludeRuntimePackages" for "Sort-AppFilesByDependencies", because it skip vsix downloading. But it skip also my file so publish function have any file for publish.

Second question, Is it possible add code to "Sort-AppFilesByDependencies" that returns input files when array have only one file?
It is not necessary sort and it can skip for me problematic code and could help to performance when one file is published.

Example for code before "# Read all app.json objects, populate $apps"

        if (@($appFiles).Count -le 1) {
            if ($excludeRuntimePackages) {
                try {
                    $tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
                    Extract-AppFileToFolder -appFilename $appFiles -appFolder $tmpFolder -generateAppJson 6> $null
                    return @($appFiles)
                }
                catch {
                    if ($_.exception.message -eq "You cannot extract a runtime package") {
                        return @()
                    }
                    else {
                        throw "Unable to extract and analyze appFile $appFiles"
                    }
                }
            }
            else {
                return @($appFiles)
            }
        }

Thank you for your help

Additional context

  • It happens on VPN or when download is not quict enought.
@rdebath
Copy link

rdebath commented Jun 4, 2024

First question is, Is it possible set parameter "$bccontainerHelperConfig.defaultDownloadTimeout" from script?

Yes, after running any BCContainerHelper command (eg: Test-BcContainer) the variable has been loaded globally and can be changed directly. Before that you change the config file.

@freddydk
Copy link
Contributor

freddydk commented Jun 4, 2024

First question is, Is it possible set parameter "$bccontainerHelperConfig.defaultDownloadTimeout" from script?

Yes, after running any BCContainerHelper command (eg: Test-BcContainer) the variable has been loaded globally and can be changed directly. Before that you change the config file.

You can also just use Import-Module BcContainerHelper - then the config variable is initialized.
Import-Module is implicit when you run the first function from the module.

@fridrichovsky
Copy link
Contributor Author

Thank you guys for your help. It looks that it helps. @freddydk if you agree with my suggestion about change in sorting function I can do this change and I can create PR for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants