autopkg / nstrauss-recipes

Public AutoPkg recipes
23 stars 27 forks source link

CricutDesignSpace Failed with Error 22 #26

Closed killer23d closed 2 years ago

killer23d commented 2 years ago

Today Cricut failed to download. Below is the log:

`

Input
        <dict>
            <key>json_key</key>
            <string>rolloutInstallFile</string>
            <key>json_url</key>
            <string>https://s3-us-west-2.amazonaws.com/staticcontent.cricut.com/a/software/osx-native/latest.json</string>
        </dict>
        <key>Output</key>
        <dict>
            <key>json_value</key>
            <string>CricutDesignSpace-Install-v7.13.105.dmg</string>
        </dict>
        <key>Processor</key>
        <string>SimpleJSONParser</string>
    </dict>
    <dict>
        <key>RecipeError</key>
        <string>Error in local.pkg.CricutDesignSpace: Processor: URLDownloader: Error: Command '['/usr/bin/curl', '--silent', '--show-error', '--no-buffer', '--dump-header', '-', '--speed-time', '30', '--location', '--url', 'https://staticcontent.cricut.com/a/software/osx-native/CricutDesignSpace-Install-v7.13.105.dmg', '--fail', '--output', '/Users/Shared/AutoPkg/Cache/local.pkg.CricutDesignSpace/downloads/tmp31lk3a5j']' returned non-zero exit status 22.</string>
    </dict>`
paul-cossey commented 2 years ago

Hi, @nstrauss

We're seeing this too.

Looks like the URL has changed slightly.

Old URL: https://staticcontent.cricut.com/a/software/osx-native/CricutDesignSpace-Install-v7.13.105.dmg New URL: https://staticcontent.cricut.com/a/software-su/osx-native/CricutDesignSpace-Install-v7.13.105.dmg

However going to the new URL in a browser doesn't download the file

<Error>
<Code>MissingKey</Code>
<Message>
Missing Key-Pair-Id query parameter or cookie value
</Message>
</Error>

I was able to manually download the dmg from https://design.cricut.com/#/ and then run mdls on the download:

 mdls /Users/paul/Downloads/CricutDesignSpace-Install-v7.13.105.dmg 
_kMDItemDisplayNameWithExtensions      = "CricutDesignSpace-Install-v7.13.105.dmg"
kMDItemContentCreationDate             = 2022-07-29 13:33:53 +0000
kMDItemContentCreationDate_Ranking     = 2022-07-29 00:00:00 +0000
kMDItemContentModificationDate         = 2022-07-29 13:34:38 +0000
kMDItemContentModificationDate_Ranking = 2022-07-29 00:00:00 +0000
kMDItemContentType                     = "com.apple.disk-image-udif"
kMDItemContentTypeTree                 = (
    "com.apple.disk-image-udif",
    "com.apple.disk-image",
    "public.archive",
    "public.data",
    "public.item",
    "public.disk-image"
)
kMDItemDateAdded                       = 2022-07-29 13:34:38 +0000
kMDItemDateAdded_Ranking               = 2022-07-29 00:00:00 +0000
kMDItemDisplayName                     = "CricutDesignSpace-Install-v7.13.105.dmg"
kMDItemDocumentIdentifier              = 0
kMDItemDownloadedDate                  = (
    "2022-07-29 13:34:38 +0000"
)
kMDItemFSContentChangeDate             = 2022-07-29 13:34:38 +0000
kMDItemFSCreationDate                  = 2022-07-29 13:33:53 +0000
kMDItemFSCreatorCode                   = ""
kMDItemFSFinderFlags                   = 0
kMDItemFSHasCustomIcon                 = (null)
kMDItemFSInvisible                     = 0
kMDItemFSIsExtensionHidden             = 0
kMDItemFSIsStationery                  = (null)
kMDItemFSLabel                         = 0
kMDItemFSName                          = "CricutDesignSpace-Install-v7.13.105.dmg"
kMDItemFSNodeCount                     = (null)
kMDItemFSOwnerGroupID                  = 20
kMDItemFSOwnerUserID                   = 502
kMDItemFSSize                          = 189360553
kMDItemFSTypeCode                      = ""
kMDItemInterestingDate_Ranking         = 2022-07-29 00:00:00 +0000
kMDItemKind                            = "Disk Image"
kMDItemLogicalSize                     = 189360553
kMDItemPhysicalSize                    = 202338304
kMDItemWhereFroms                      = (
    "https://staticcontent.cricut.com/a/software-su/osx-native/CricutDesignSpace-Install-v7.13.105.dmg?Expires=1659102231&Signature=BgKGhNhWybUoZKckUYUQURyoL29O6Bt1VzbneysvSUTTZYGkcAPoBx35CGFQdRDUjLUTmZJNRXg5WlUH2x20DPX1BwwKV7NXj6KuBgnSNg-F5xiDh9k0hL6ETJWXK9ThQrCIsLt7vncwK9Sme9k6cqFb63VaSfX6uobNRHnL8LcgRARLMNGQI8SznFDHTP5MwHLPUQv9CMxxb6MipwAjcKP7~5jsWO-zCf5-lPC~tjnwo9jaTFKRPEymGCvruxXuglckE~eynxnXl2i2NSbHbw~rV0rjbdmeqKOOTtZARJMyE7f45TYMJkRTDY62acAR7bsat1KHL1Dgk3U-rHjKbQ__&Key-Pair-Id=K2W1AJ47IQWIOI",
    "https://design.cricut.com/"
)

Seems to be the download URL is dynamically created and requires a token now :-(

This is from the InstallerFile header

Summary
URL: https://apis.cricut.com/desktopdownload/InstallerFile?shard=a&operatingSystem=osxnative&fileName=CricutDesignSpace-Install-v7.13.105.dmg
Status: 200
Source: Network
Address: 108.138.217.44:443
Initiator: 
design.cricut.com:1:780

Request
:method: GET
:scheme: https
:authority: apis.cricut.com
:path: /desktopdownload/InstallerFile?shard=a&operatingSystem=osxnative&fileName=CricutDesignSpace-Install-v7.13.105.dmg
Accept: application/json, text/plain, */*
Origin: https://design.cricut.com
Accept-Encoding: gzip, deflate, br
Host: apis.cricut.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15
Accept-Language: en-GB,en;q=0.9
Referer: https://design.cricut.com/
Connection: keep-alive

Response
:status: 200
Access-Control-Allow-Credentials: true
Content-Type: application/json; charset=utf-8
Via: 1.1 849d578ca949358328a9c41e066f78ac.cloudfront.net (CloudFront)
Date: Fri, 29 Jul 2022 14:19:19 GMT
Access-Control-Allow-Origin: https://design.cricut.com
Vary: Origin
x-cache: Miss from cloudfront
x-amz-cf-pop: LHR61-P3
x-amzn-trace-id: Root=1-62e3ec67-6dc9a52724b78d852294c167
api-supported-versions: 1, 2
x-amz-cf-id: dxQVNo4eaJdxxyTHpZPRjnnjmU6h9fthKIOXCGim7Gw_5ll43qqcCg==

Query String Parameters
shard: a
operatingSystem: osxnative
fileName: CricutDesignSpace-Install-v7.13.105.dmg
nstrauss commented 2 years ago

@killer23d @paul-cossey Thanks for reporting and the investigative work. Made fixing this fairly easy. Recipe now makes an API request to get a token for each run. Worked on successive runs for me. Fix committed and closing comment. Let me know if still an issue in the future.

134b665cf68e36b70abaa40ac00fdd5def5c1cb1