vercel / hazel

Lightweight update server for Electron apps
https://twitter.com/notquiteleo/status/893547786255421441
MIT License
2.91k stars 384 forks source link

Keep getting "invalid JSON response" on private GitHub repo #131

Open ryandunnewold opened 3 years ago

ryandunnewold commented 3 years ago

In the docs it says that private repos automatically sets the URL environment variable. It doesn't properly return it though and autoUpdater throws an error:

Here is original code: https://github.com/vercel/hazel/blob/a06e6c5e4acdab0339c14361f086c3f6ff8a10fc/lib/routes.js#L162-L169

Here is the solution that worked for me. Curious if there is a more elegant way to solve this:

 send(res, 200, {
    name: latest.version,
    notes,
    pub_date,
    url: shouldProxyPrivateDownload
      ? `https://${url}/download/${platformName}?update=true`
      : latest.platforms[platform].url
  })
tarikhaiga commented 3 years ago

@ryandunnewold Thanks for sharing this! I'm quite new here, not really sure how I can use your fix with my own private repo?

Juned-H2 commented 2 years ago

@ryandunnewold Thanks for sharing this! I'm quite new here, not really sure how I can use your fix with my own private repo?

You can edit the files directly in your Vercel hazel fork.

omerts commented 2 years ago

This is a showstopper bug on macOS that should really be handled immediately. Also the documentation for configuring the server address is missing the https:// prefix.

omerts commented 2 years ago

@ryandunnewold Thanks for sharing this! I'm quite new here, not really sure how I can use your fix with my own private repo?

You can edit the files directly in your Vercel hazel fork.

I changed it in my fork, but it still returns the old url, is there any other step that needs to be done? like clearing the a cache?

EDIT: Ok figured it out, had to promote to production, and use the production link for it to work

btribouillet commented 2 years ago

Same issue here, I will update it in my fork as well.

Nkzn commented 2 years ago

I have same issue.

Request

https://my-hazel-server.vercel.app/update/darwin/0.1.8

Response

{"name":"v0.1.9","notes":null,"pub_date":"2022-06-14T05:50:23Z","url":"my-hazel-server.vercel.app.vercel.app/download/darwin?update=true"}

this response contains "url":"my-hazel-server.vercel.app.vercel.app/download/darwin?update=true". this is wrong url.