Live update: store_manifest failed

I’m checking Live update functions. Following this example, I got liveupdate.game.dmanifest file from new live-update bundle and served it at my server. When attempt to download and store it to the app, it printed “Failed to store manifest”. My question is that what could lead to store failure? What did I do wrong?

In case of it’s successfully stored, will it make the collectionproxy.missing_resources(...) return missing resources for which scripts/resources I just modified ?

local function store_manifest_cb(self, status)
  if status == liveupdate.LIVEUPATE_OK then
    pprint("Successfully stored manifest. This manifest will be loaded instead of the bundled manifest the next time the engine starts.")
  else
    pprint("Failed to store manifest")
  end
end

local function download_and_store_manifest(self)
  http.request(MANIFEST_URL, "GET", function(self, id, response)
      if response.status == 200 then
        liveupdate.store_manifest(response.response, store_manifest_cb)
      end
    end)
end

It seems there’s no liveupdate.LIVEUPATE_OK constant (The documentation might need to be updated). I guess status = 0 means it was successfully stored.

Generally, I need a solution for updating stuff such as hotfixes, new game update features… Any guides would be appreciated!

It should be there. Here I print all values on liveupdate.*:

for k,v in pairs(liveupdate) do
    print(k, v)
end
DEBUG:SCRIPT: store_manifest	function: 0x6d8ad0
DEBUG:SCRIPT: add_mount	function: 0x6d8ba0
DEBUG:SCRIPT: LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH	-8
DEBUG:SCRIPT: LIVEUPDATE_SIGNATURE_MISMATCH	-6
DEBUG:SCRIPT: LIVEUPDATE_IO_ERROR	-10
DEBUG:SCRIPT: get_current_manifest	function: 0x6d1908
DEBUG:SCRIPT: store_archive	function: 0x6d8b18
DEBUG:SCRIPT: get_mounts	function: 0x6d8b60
DEBUG:SCRIPT: LIVEUPDATE_UNKNOWN	-1000
DEBUG:SCRIPT: LIVEUPDATE_OK	0
DEBUG:SCRIPT: store_resource	function: 0x6d8a88
DEBUG:SCRIPT: LIVEUPDATE_NOT_INITIALIZED	-12
DEBUG:SCRIPT: LIVEUPDATE_INVAL	-11
DEBUG:SCRIPT: LIVEUPDATE_FORMAT_ERROR	-9
DEBUG:SCRIPT: LIVEUPDATE_INVALID_RESOURCE	-3
DEBUG:SCRIPT: is_using_liveupdate_data	function: 0x6d8a38
DEBUG:SCRIPT: LIVEUPDATE_INVALID_HEADER	-1
DEBUG:SCRIPT: LIVEUPDATE_SCHEME_MISMATCH	-7
DEBUG:SCRIPT: remove_mount	function: 0x6d8be0
DEBUG:SCRIPT: LIVEUPDATE_VERSION_MISMATCH	-4
DEBUG:SCRIPT: LIVEUPDATE_ENGINE_VERSION_MISMATCH	-5
DEBUG:SCRIPT: LIVEUPDATE_MEM_ERROR	-2

Notice that LIVEUPDATE_OK is 0:

DEBUG:SCRIPT: LIVEUPDATE_OK	0
1 Like

Ah yes, I just realized, so there’s a typo in the example, the documentation is still need to be updated :slight_smile:

Fixed: Fixed typo in api docs · defold/defold@cf3a9e5 · GitHub

1 Like

Also in this documentation, the code seems wrong at callback

local function mount_zip(self, name, priority, path, callback)
	liveupdate.add_mount(name, "zip:" .. path, priority, function(_uri, _path, _status) -- <1>
		callback(_uri, _path, _status)
	end)
end

In my code, I put a print for debug

liveupdate.add_mount(update.version, "zip:"..download_path, priority + i, function(_uri, _path, _status, abc)
	pprint(_uri, _path, _status, abc)
end)

Here is what I got:
DEBUG:SCRIPT: Script: 0x021485e73c70, 1.2.7, zip:C:\Users\chung\AppData\Roaming\KyHoang_Update\1.2.7.zip, 0

From what I see, the callback should be function(self, name, uri, status)

Yes, you are correct. That code is from my own test project and I hadn’t noticed that I had setup my callback wrong.

I also wanted to point out that we consider the storage of liveupdate manifests and single files as deprecated.

We want to promote the “mounts” way of doing live update as the better approach.
We want to improve on the tooling a bit more, to support easier creation of multiple zip archives, but still, the new api is what we want to promote going forwards.

2 Likes

It’s ok. I got a solution for my app hotfixes update. I will just use mounts but the zip file just includes modified/new files compared to the previous version. What in my concern now is that I need to find an easy way to work with the game.graph.json file. It would be great if we have a tool to parse and work with it.