How to access datastore in props options method

I’m storing user information in datastore with the key is user email and value is user detail. In my source I would like to access a list of user emails but the code throws error

export default {
  name: "Contact Updated",
  version: "0.0.1",
  key: "contact-updated",
  description: "Triggers when an existing contact is updated.",
  props: {
    db: "$.service.db",
    http: "$.interface.http",
    integrationAccount: {
      type: "string",
      label: "Account",
      options() {
        return this.db.get('accounts').keys();
      },
    },
  },
}

this is the error

pd deploy sources/contact-updated/contact-updated.mjs
Configuring props...
Configuring prop db...
Configuring prop http...
Configuring prop integrationAccount...
---------------
error          
TypeError: Cannot read property 'get' of null

I realize that $.service.db is not the same with data store is it possible to access data store in source by using code?

Hi @jacksontong

First off, welcome to the Pipedream community. Happy to have you!

Great questions for a first post.

First thing I noticed about your component code is that it’s missing the type: "source" property. You can try adding that as well to help.

I don’t believe the $.service.db is accessible outside of the run function in sources.

You may be able to use a Data Store instead.