# registerDataPlugin causes cannot read properties of undefined (reading 'organization') error

**URL:** <https://forum.builder.io/t/registerdataplugin-causes-cannot-read-properties-of-undefined-reading-organization-error/1161>\
**Category:** Technical Questions\
**Tags:** plugin\
**Created:** [October 11, 2021, 7:06pm UTC](https://forum.builder.io/t/registerdataplugin-causes-cannot-read-properties-of-undefined-reading-organization-error/1161 "2021-10-11T19:06:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lollen](https://avatars.discourse-cdn.com/v4/letter/l/6bbea6/32.png) [@lollen](https://forum.builder.io/u/lollen)\
**Post date:** [October 11, 2021, 7:06pm UTC](https://forum.builder.io/t/registerdataplugin-causes-cannot-read-properties-of-undefined-reading-organization-error/1161/1 "2021-10-11T19:06:59Z")

</div>

**What are you trying to accomplish**  
I want to explore developing a data plugin

**Screenshots or video link**

> **[11 October, 2021 9:02:02 pm - Screenshot](https://www.loom.com/i/1245007bd8854bc1a48763826b8d3d4e)**
>
> Check out a screenshot I made via Loom

**Code stack you are integrating Builder with**  
NextJS

**Reproducible code example**

```auto
import { registerDataPlugin } from '@builder.io/data-plugin-tools';

registerDataPlugin({
    id: "@example/plugin-dummy",
    name: "lollenplugindummy",
    settings: [],
    ctaText: `plugin-dummy to test out functionality`,
    getResourceTypes: async () => {
        return [{
            id: "alldogs",
            name: "All dogs",
            description: "Get a list of all dog breeds",
            toUrl: (options: any) => {
                return "https://dog.ceo/api/breeds/list/all"
            },
            canPickEntries: true,
            inputs: () => []
        }]
    },
})

```

The above code when run throw a Cannot read properties of undefined (reading ‘organization’) error.

Suspecting the errors are from the rows referencing appState.user.organization (appState.user being undefined) in [builder/index.ts at 395b715bf359b086a8d287b6be5aa172303bdd20 · BuilderIO/builder · GitHub](https://github.com/BuilderIO/builder/blob/395b715bf359b086a8d287b6be5aa172303bdd20/packages/data-plugin-tools/src/index.ts)

I therefore tried to import appState from @builder.io/app-context but it only gives me an empty object (which might explain the above error cause)

I have not been able to find any documentation to work around this issue other than possibly the license levels describing private plugins requiring enterprise license.

Worth mentioning, registering custom components and testing it out trough [builder.io](http://builder.io) page builder works excellent, so the code is initialized correctly i believe.

Anyone got any advice?

Cheers!

---

<div class="post-metadata">

**Author:** ![aziz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/aziz/32/2551_2.png) [@aziz](https://forum.builder.io/u/aziz)\
**Post date:** [October 11, 2021, 11:17pm UTC](https://forum.builder.io/t/registerdataplugin-causes-cannot-read-properties-of-undefined-reading-organization-error/1161/2 "2021-10-11T23:17:39Z")

</div>

Hi @lollen , looking at the interface I think you’re using an outdated version of `@builder.io/data-plugin-tools` module, but don’t think it’s related to the error you’re seeing, I think the error has something to do with webpack not playing well with one of our `externals`, I went ahead and released the latest code to npm and added an example that uses `rollup` with sample code and instructions that should help you with a starting point on how to add data plugins to builder, you can find it [here](https://github.com/BuilderIO/builder/tree/main/plugins/example-data-plugin) , for an example of a data plugin that we current use in production check our [contentful data plugin source code](https://github.com/BuilderIO/builder/tree/main/plugins/contentful)
