Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Latest Lighthouse 5.2 #24

Open
nateclarks opened this issue Sep 19, 2019 · 4 comments
Open

Upgrade to Latest Lighthouse 5.2 #24

nateclarks opened this issue Sep 19, 2019 · 4 comments

Comments

@nateclarks
Copy link

Hi the lighthouse npm package is out of date. I tried to update the package.json to lighthouse 5.2 and the dockerfile to the node 10 base layer ( as lighthouse 5.2 depends on node 10) but when I do so it fails to work with influx?

garie-lighthouse_1 | Application listening on port 3000
garie-lighthouse_1 | (node:19) UnhandledPromiseRejectionWarning: Failed to initialise influx
garie-lighthouse_1 | (node:19) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

I tried removing the try catch on the influxdb initialise which allows lighthouse to then run but it then doesn't write to influx

thanks :)

@MarcoFaul
Copy link

MarcoFaul commented Nov 14, 2019

Hi @nateclarks, did you find any solution to this problem?

@danipolo
Copy link

danipolo commented Dec 4, 2019

Same problem here :(

@GerardSmit
Copy link

@nateclarks @MarcoFaul the problem is the function init() in influx/index.js. The function is async but returns a Promise. Also, the try-catch isn't working because it's returning a promise instead of awaiting it.

You'll need to change the function to be fully async-await. See the example below. I won't make a pull request since there are 5 PR's where one is still open since 2018 and didn't have any response by the owner of the repository.

File: src/influx/index.js
Line 4 - 20
Source: Fork (GerardSmit/garie-lighthouse)

/**
 * Bootstrap the database
 */
const init = async () => {
	try {
		const names = await influx.getDatabaseNames();
		if (names.indexOf('lighthouse') === -1) {
			logger.info('InfluxDB: lighthouse database does not exist. Creating database');
			await influx.createDatabase('lighthouse');
			logger.info('InfluxDB: lighthouse database created');
		}
		logger.info('InfluxDB', 'lighthouse database already exists. Skipping creation.');
	} catch (err) {
		throw new Error('Failed to initialise influx: ' + err)
	}
};

@Kiina
Copy link

Kiina commented Nov 23, 2020

Also works with lighthouse 6.4 and node 14.15-slim lts. Maybe you can update it in your fork and open a merge request? I don't have many high hopes of it getting merged when looking at it, but maybe it's easier for people to find then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants