Unexpected error "...msi' to be of length '108967460' but the length was '113770496'.
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
During automated testing of a package on chocolatey.org, the following error occurs:
```
2017-10-10 16:31:53,296 2696 [DEBUG] - No runtime virus checking built into FOSS Chocolatey. Check out Pro/Business - https://chocolatey.org/compare
2017-10-10 16:31:53,312 2696 [DEBUG] - Checking that 'C:\Users\Administrator\AppData\Local\Temp\chocolatey\invantive-control-for-excel\17.10.2\Invantive Control for Excel-17.10.2.msi' is the size we expect it to be.
2017-10-10 16:31:53,390 2696 [ERROR] - ERROR: Chocolatey expected a file at 'C:\Users\Administrator\AppData\Local\Temp\chocolatey\invantive-control-for-excel\17.10.2\Invantive Control for Excel-17.10.2.msi' to be of length '108967460' but the length was '113770496'.
at Get-ChocolateyWebFile, C:\ProgramData\chocolatey\helpers\functions\Get-ChocolateyWebFile.ps1: line 373
at Install-ChocolateyPackage, C:\ProgramData\chocolatey\helpers\functions\Install-ChocolateyPackage.ps1: line 324
at , C:\ProgramData\chocolatey\lib\invantive-control-for-excel\tools\chocolateyinstall.ps1: line 26
at , C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1: line 48
2017-10-10 16:31:35,109 2696 [DEBUG] - Request Headers:
2017-10-10 16:31:35,140 2696 [DEBUG] - 'Accept':'*/*'
2017-10-10 16:31:35,140 2696 [DEBUG] - 'User-Agent':'chocolatey command line'
2017-10-10 16:31:35,749 2696 [DEBUG] - Response Headers:
2017-10-10 16:31:35,781 2696 [DEBUG] - 'Connection':'keep-alive'
2017-10-10 16:31:35,781 2696 [DEBUG] - 'x-amz-meta-cb-realsize':'113770496'
2017-10-10 16:31:35,781 2696 [DEBUG] - 'x-amz-meta-cb-modifiedtime':'Sat, 07 Oct 2017 15:06:32 GMT'
2017-10-10 16:31:35,781 2696 [DEBUG] - 'x-amz-version-id':'null'
2017-10-10 16:31:35,796 2696 [DEBUG] - 'X-Cache':'Miss from cloudfront'
2017-10-10 16:31:35,796 2696 [DEBUG] - 'X-Amz-Cf-Id':'78pQgY0jFk2giwRiLo-8zpa2_TEgZLY9zISh9RTWstPv8NR5qPFjaw=='
2017-10-10 16:31:35,796 2696 [DEBUG] - 'Accept-Ranges':'bytes'
2017-10-10 16:31:35,812 2696 [DEBUG] - 'Content-Length':'108967460'
2017-10-10 16:31:35,812 2696 [DEBUG] - 'Content-Type':'application/octet-stream'
2017-10-10 16:31:35,812 2696 [DEBUG] - 'Date':'Tue, 10 Oct 2017 16:31:36 GMT'
2017-10-10 16:31:35,812 2696 [DEBUG] - 'ETag':'"91d27985efe605ff75eab3146384bc19-11"'
2017-10-10 16:31:35,828 2696 [DEBUG] - 'Last-Modified':'Sun, 08 Oct 2017 06:56:14 GMT'
2017-10-10 16:31:35,828 2696 [DEBUG] - 'Server':'AmazonS3'
2017-10-10 16:31:35,828 2696 [DEBUG] - 'Via':'1.1 7f3f42df8af148df1f9f1ee7175987ad.cloudfront.net (CloudFront)'
2017-10-10 16:31:35,874 2696 [INFO ] - Downloading invantive-control-for-excel 64 bit
from 'https://download.invantive.com/release/msi/Invantive%20Control%20for%20Excel-17.10.2.msi'
```
The MSI is served through Amazon CloudFront, taken from an S3 bucket.
The HTTP headers defined on the file in S3 include "Content-Encoding: gzip", with a content-length of 108967460. However, after expansion it is a little larger.
Due to limitations of CloudFront we serve the file always compressed. You can not specify that the file should be uncompressed when the requestor does not send along that he accepts gzip.
Formally this is a configuration error on CloudFront, but it would be great when this limitation of CloudFront handling compressed files would be countered by a change in the automated test.
When the automated test would request the files gzipped when available, such as described on https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding that would save some issues.
For this use case, we will switch to a different deployment method to S3.
Contributor guide
Research direction
Start at Get-ChocolateyWebFile.ps1 line 373, where the downloaded file length is checked, and review the automated download test and the related Install-ChocolateyPackage.ps1 call at line 324. Reproduce the CloudFront/S3 case with gzip content and verify that the test handles the encoded response and expanded file size correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, powershell
- Domain
- cloud, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100