Changes between jovo-framework 2.2.25 and 2.2.29?

amazon-alexa

#1

@AlexSwe

I just upgraded my jovo-framework from 2.2.25 and 2.2.29 and now my unit tests are not passing.

One way that we have extended Jovo is by adding functions on the main Jovo object:

// app.js

Jovo.prototype.log = require('./jovo-ext/log.js');
//log.js
'use strict';

const logLevel = process.env.LOG_LEVEL;
const log = require('console-log-level')({ level: logLevel });

module.exports = log;

And then using it in a handler:

// handler.js
  NEW_USER() {
    this.log.info('newUserHandler ---> NEW_USER');

The error that I am getting in the handler is:
Cannot read property ‘info’ of undefined

What changed in the framework that would cause this?
What is the recommended way to do what I am doing?
I have 6 functions that I am adding to the root Jovo object for easy access in handler.

Thanks!


#2

Hey Mark

We haven’t changed anything that would cause that issue. I took your code and it works here as expected.
It’s probably the “update-bug”. Could you delete package-lock.json and /node_modules and run npm i again?


#3

That fixed it. Do you have a link or more info on this “update-bug”?

Thanks,

Mark


#4

Yes, it’s a weird bug. I could reproduce it on Friday, but I can’t now. I had a system reboot. Maybe it’s a npm caching thing.

I’ll keep you posted.