# Forge storage query : Variable "$range" got invalid value null

**URL:** <https://community.developer.atlassian.com/t/forge-storage-query-variable-range-got-invalid-value-null/79228>\
**Category:** Forge\
**Tags:** forge-storage\
**Created:** [April 17, 2024, 9:59am UTC](https://community.developer.atlassian.com/t/forge-storage-query-variable-range-got-invalid-value-null/79228 "2024-04-17T09:59:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uli](https://avatars.discourse-cdn.com/v4/letter/u/ccd318/32.png) [@Uli](https://community.developer.atlassian.com/u/Uli)\
**Post date:** [April 17, 2024, 9:59am UTC](https://community.developer.atlassian.com/t/forge-storage-query-variable-range-got-invalid-value-null/79228/1 "2024-04-17T09:59:47Z")

</div>

Hi,

I’m trying to use the Forge storage system, but I’m having a hard time, even looking deep into the documentation.  
I’m trying to follow [https://developer.atlassian.com/platform/forge/custom-entities-store-structured-data/](https://developer.atlassian.com/platform/forge/custom-entities-store-structured-data/)

And it’s a UI kit 2 app

I got up to:

manifest:

```auto
  storage:
    entities:
    # Define a custom entity for storing project groups
    - name: 'jiraproject-group'
      attributes:
        groupname:
          type: 'string'
        projectkey:
          type: 'string'
      indexes:
        # Index to query project groups by name
      - name: 'by-groupName'
        range:
        - 'groupname'
      - name: 'by-projectkey'
        range:
        - 'projectkey'

```

got this to run without error (don’t know if it did anything ):

```auto

    const projectGroupData = {
      groupname: groupName,
      projectkey: project.key
    };

    await storage
      .entity(jiraprojectGroupEntityPath)
      .set(`group-${uuidv4()}`, projectGroupData);
      }

```

But when I call:

```auto
    const query = await storage
      .entity(jiraprojectGroupEntityPath)
      .query()
      .index('by-groupname')
      .where(WhereConditions.beginsWith(searchQuery))
      .getMany();

```

I get:

```auto
Error: There was an error invoking the function - Variable "$range" got invalid value null at "range.values[0]"; Expected non-nullable type "AppStoredCustomEntityFieldValue!" not to be null.

```

Am I missing something with storage definition? Partition? I’m a bit fuzzy now.

---

<div class="post-metadata">

**Author:** ![Uli](https://avatars.discourse-cdn.com/v4/letter/u/ccd318/32.png) [@Uli](https://community.developer.atlassian.com/u/Uli)\
**Post date:** [April 18, 2024, 9:45am UTC](https://community.developer.atlassian.com/t/forge-storage-query-variable-range-got-invalid-value-null/79228/2 "2024-04-18T09:45:15Z")

</div>

Nevermind, the problem between the chair and the keyboard…

typo by-groupName != by-groupname

and may be something else… but now it works!

---

<div class="post-metadata">

**Author:** ![david](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/david/32/44964_2.png) [@david](https://community.developer.atlassian.com/u/david)\
**Post date:** [April 18, 2024, 10:42am UTC](https://community.developer.atlassian.com/t/forge-storage-query-variable-range-got-invalid-value-null/79228/3 "2024-04-18T10:42:23Z")

</div>

PICNIC error.

> Problem In Chair Not In Computer

🙃

---

<div class="post-metadata">

**Author:** ![Uli](https://avatars.discourse-cdn.com/v4/letter/u/ccd318/32.png) [@Uli](https://community.developer.atlassian.com/u/Uli)\
**Post date:** [April 18, 2024, 11:46am UTC](https://community.developer.atlassian.com/t/forge-storage-query-variable-range-got-invalid-value-null/79228/4 "2024-04-18T11:46:44Z")

</div>

Still in case someone encounter the same, here was the issue (I just reproced it):

```auto
resolver.define('searchGroupsByName', async (payload)

```

should be

```auto
resolver.define('searchGroupsByName', async ({payload, context})

```

Otherwise you end up with payload = {payload : {myVar:‘ploup’}, context : {…}}  
Instead of payload = {myVar:‘ploup’}

Which end up passing on weird variable to the following functions 😃
