Issues loading config in extension

In Developing an extension - getting access to the core I mentioned I had problems loading config.

I have been chasing it down and can’t get it to work. As far as I can tell (and I would be delighted to be contradicted) the problem occurs in gateway-addon-note /lib/database.js or in the libraries it uses.

What I see is that the promise returns in the extension code before the config data is loaded from the database.

What I’ve done:

  • Created the config related entries in manifest.json and tested that they work as I expect. image
  • Checked that the data appears in the gateway db.sqlite3
  • added a few debug lines in lib/database.js image
  • The code in the problem area has not changed much since the original posting. It is available in github / pages-extension / testing branch
  • After restarting the extension in the gateway, I see in the log
  • what this shows is that the data is returned in database.js around 30ms after it is expected and tested in the extension code.

What have I done wrong?

Sorry about the screenshots. I would have preferred pre or block quote but it got horribly messed up, so I ended up with screenshots

Fix here:

1 Like

wow thanks!
a couple of missing end-of lines did that? I’ll have to find a checking tool that ensures I never do that again.

No, the missing return was the problem.

I’m using VSCode and it is deleting all trailing whitespace, including the last return as each javascript file is saved. Now to learn to configure it correctly.

That’s not what I’m talking about. db.loadConfig() vs. return db.loadConfig().

1 Like

doh! got it. apologies for my stupidity

No one is calling you stupid! Just glad it’s working now.

1 Like