Electron update-available and update-downloaded event not fire on client - electron

when client call autoUpdater.checkForUpdates() i can see the server log display this:
debug: Windows Update Search Query {
platform: ['windows_32'],
version: '2.0.0',
channel: 'stable'
}
debug: Applicable Channels['stable'] debug: Time Filter {
'>=': 2017 - 09 - 20 T08: 43: 10.000 Z
}
debug: Latest Windows Version {
assets: [{
name: 'DesktopAlert-3.0.0-ia32-full.nupkg',
platform: 'windows_32',
filetype: '.nupkg',
hash: '3536C0AD153B97027FEDE24CE1E9FE6C9863E04B',
size: 52623567,
download_count: 0,
fd: 'C:\Projects\electron-release-server\data\34506780-7e2c-487e-9bb6-67b47674e76b.nupkg',
createdAt: '2017-09-20T09:11:09.000Z',
updatedAt: '2017-09-20T09:11:09.000Z',
version: '3.0.0'
}],
channel: 'stable',
name: '3.0.0',
notes: '',
createdAt: '2017-09-20T08:43:31.000Z',
updatedAt: '2017-09-20T08:43:31.000Z'
}
but on the client, there is no event fired.
here is the client code for the auto update
autoUpdater.on('update-not-available', (event, releaseNotes, releaseName) => {
console.log(event)
mainWindow.webContents.send('update-not-available', {
msg: event
})
})
autoUpdater.on('update-available', (event, releaseNotes, releaseName) => {
console.log(event)
mainWindow.webContents.send('update', {
msg: event
})
})
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
console.log(event)
mainWindow.webContents.send('downloaded', {
msg: event
})
const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Application Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
}
dialog.showMessageBox(dialogOpts, (response) => {
if (response === 0) autoUpdater.quitAndInstall()
})
})
autoUpdater.on('checking-for-update', (event, releaseNotes, releaseName) => {
console.log(event)
mainWindow.webContents.send('checking', {
msg: event
})
})
autoUpdater.on('error', message => {
console.error('There was a problem updating the application')
console.error(message)
})
please help, did I forget anything?
P/s: sorry for the code format, don't know how to put code quote

Related

Add metadata from projection

given following projection:
options({
$includeLinks: false,
reorderEvents: false,
processingLag: 0
});
fromCategory('my_events')
.partitionBy(({ data }) => data.Id)
.when({
$init: () => {
return {
data: {
Id: null,
Version: 0,
Key: null,
Title: null
}
};
},
ItemAdded: (state, { data }) => {
state.data = {
Version: state.data.Version + 1,
...data
};
How can I write specific metadata to the output stream item_state-{0}? I'd basically like to avoid putting the relevant stuff to the state as I also want to directly process events on client side, where I have the required info in metadata.

Why my Vercel serverless functions not working in production?

Hello I have a problem when I deploy my application in vercel, I am creating a function without server that brings me the data of a collection in mongodb, using mongoose. In local everything works fine but when I deploy the function it gives me this error:
504: GATEWAY_TIMEOUT
Code: FUNCTION_INVOCATION_TIMEOUT
ID: gru1 :: 594vg-1620811347355-66f311d5c992
I understand that the free plan of vercel allows you to create functions with a maximum of 10 seconds of waiting, is this why I get the error? Or it may be for one of these reasons: https://vercel.com/support/articles/why-does-my-serverless-function-work-locally-but-not-when-deployed
Serverless function:
import mongoose from "mongoose";
module.exports = function(req, res) {
const Schema = mongoose.Schema;
const inmuebleSchema = new Schema({
user_id: String, //{type: Schema.Types.ObjectId, ref: 'User'}
desc: String,
tipo_propiedad: { type: String, enum: ["casa", "quinta", "departamento"] },
amb: Number,
estado: { type: String, enum: ["venta", "alquiler"] },
banios: Number,
dorm: Number,
coch: Number,
direc: String,
precio: String,
images: { type: Array, default: [] },
uploadedDate: { type: Date, default: Date.now() }
});
const Inmueble = mongoose.model("inmueble", inmuebleSchema);
mongoose
.connect(process.env.MONGODB_URI, {
useNewUrlParser: true,
useUnifiedTopology: true
})
.then(() => {
Inmueble.find()
.exec()
.then(inmuebles => res.json({ inmuebles }))
.catch(err => res.json({ status: "error" }));
})
.catch(err => {
res.status(500);
});
};
The problem was, I wasn't adding my site's IP to my cluster's whitelist.

Can not update electron application

Does anybody hit this error while updating autoupdate for electron application.
It says:
Error: Can not find Squirrel
enter image description here
below is my code:
const server = 'http://10.172.120.67:8081'
// const url = `${server}/update/${process.platform}/${app.getVersion()}`
const url = `${server}/update/`
console.log(url)
autoUpdater.setFeedURL({ url })
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
console.log("getin")
const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Application Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
}
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) autoUpdater.quitAndInstall()
})
})
autoUpdater.on('error', message => {
console.error('There was a problem updating the application')
console.error(message)
})
autoUpdater.on('update-avliable', function (info){
console.log('update-avliable')
})
autoUpdater.on('checking-for-update', function () {
console.log('checking-for-update')
});
console.log("hello electron")
autoUpdater.checkForUpdates();
Try calling the check for updates when the app is ready:
app.on('ready', function() {
autoUpdater.checkForUpdates();
}

Electron-builder "update-available" event not being triggered when a new release is available

I am trying to use the auto update feature of the electron-builder, I have added listeners for update-not-available and update-available. If there are no new updates the update-not-available event is triggered successfully but for some reason when a new version of my app is available the update-available event is not being triggered, is there any way to check why the event is not being triggered or add logs to see if any error is occurring?
Below is my code for main.js
const { autoUpdater } = require("electron-updater");
...other imports
app.on('ready', () => {
//do this
//Check for updates.
autoUpdater.checkForUpdates();
}
autoUpdater.on("update-not-available", (info) => {
const dialogOpts = {
type: 'info',
buttons: ['Ok'],
title: 'Application Update',
message: "Yay",
detail: 'No new updates.'
}
dialog.showMessageBox(dialogOpts, (response) => {
});
});
autoUpdater.on("update-available", (info) => {
const dialogOpts = {
type: 'info',
buttons: ['Ok'],
title: 'Application Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version is being downloaded.'
}
dialog.showMessageBox(dialogOpts, (response) => {
});
})
autoUpdater.on("update-downloaded", (info) => {
const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Application Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
}
dialog.showMessageBox(dialogOpts, (response) => {
if (response === 0) autoUpdater.quitAndInstall()
});
});
I was able to get the reason for failure by running the executable from the command line. It was failing because of the below line
message: process.platform === 'win32' ? releaseNotes : releaseName,
Because the variables were undefined. It was fixed by changing the call back function arguments to include releaseName and releaseNotes like so
autoUpdater.on("update-available", (event, releaseNotes, releaseName) => {
As provided in the docs here.

Cloudboost logout function

When I try to log out the current user of my app I get this message : TypeError: CB.CloudUser.current.logOut is not a function
Here is my code :
$scope.logout = function() {
CB.CloudUser.current.logOut({
success: function(user) {
//log out successfull
var currentUser = user;
$timeout(function() {
$scope.userConnected = false;
document.getElementById("body-container").className = "hold-transition login-page";
});
},
error: function(err) {
//Error occured in user registration.
}
});
Thank you for your help.
Here is what I have in CB.CloudUser.current:
CB.CloudObject {document: Object}
ACL: (...)
createdAt: (...)
document: Object
ACL: CB.ACL
_id: "OUVrZf9T"
_tableName: "User"
_type: "custom"
_version: 1
createdAt: "2016-02-27T21:15:09.013Z"
email: ""
expires: null
password: ""
updatedAt: "2016-02-27T21:15:27.403Z"
username: "malignois"
__proto__: Object
expires: (...)
id: (...)
updatedAt: (...)
__proto__: CB.CloudObject
I know this is old but this is what works for me. I am using Ionic 2, but the syntax should be the same. Hope this helps.
CB.CloudUser.getCurrentUser({
success: function (user) {
// Success getting current user
user.logOut({
success: function () {
// Success logging out
},
error: function () {
// Error logging out
}
});
},
error: function () {
// Error getting current user
}
});

Resources