Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: Cannot read properties of undefined (reading 'databaseName') #1017

Open
RelatableApp opened this issue Oct 26, 2024 · 4 comments
Open

Comments

@RelatableApp
Copy link

RelatableApp commented Oct 26, 2024

I am using the configuration from the example using the repository method but it gives TypeError: Cannot read properties of undefined (reading 'databaseName').
TypeORM version 0.3.20
nestjs-paginate version 9.1.2

this is my service

async findAll(query: PaginateQuery): Promise<Paginated<Sessions>> {
    try {
      const result = await paginate(query, this.sessionRepo, {
        relations: { files: true, transcript: true },
        sortableColumns: ['id', 'name', 'is_active', 'timeTaken'],
        nullSort: 'last',
        defaultSortBy: [['created_at', 'DESC']],
        searchableColumns: ['name', 'id', 'user_id', 'files.url'],
        filterableColumns: {
          user_id: [FilterOperator.EQ],
          'files.url': [
            FilterOperator.CONTAINS,
            FilterOperator.EQ,
            FilterOperator.ILIKE,
          ],
        },
      });
      return result;
    } catch (error) {
      console.log(error);
    }
  }
@Helveg
Copy link
Collaborator

Helveg commented Oct 27, 2024

Can you post the full error log please? And can you show how this.sessionRepo is created? I think there's going to be a not nestjs-paginate related error in your module setup. I'd need the error to know for sure.

@williamaditama
Copy link

I think this might be due to that 'files.url' part on the searchableColumns. I'm facing the same issue when trying to sort by a field inside a JSON column

@AliRezaBeitari
Copy link

I'm facing the same issue. It's related to the nullSort parameter in my case. When I remove it, it works fine!

@NeniEmSu
Copy link

I'm facing the same issue. It's related to the nullSort parameter in my case. When I remove it, it works fine!

This worked for me too thanks

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants