This is a template you can use to report issues. You can also drag images, videos and include Preformatted text
Expected behavior
I should be able to see the table data instead of “Your server encountered an error”
Actual behavior
I see “Your server encountered an error”
Failure Logs
TypeError: Cannot read property 'startsWith' of undefined
at /xxx/node_modules/forest-express-sequelize/dist/services/query-builder.js:92:21
at Array.filter (<anonymous>)
at /xxx/node_modules/forest-express-sequelize/dist/services/query-builder.js:91:62
at Array.forEach (<anonymous>)
at QueryBuilder.getIncludes (/xxx/node_modules/forest-express-sequelize/dist/services/query-builder.js:86:8)
at ResourcesGetter.count (/xxx/node_modules/forest-express-sequelize/dist/services/resources-getter.js:213:39)
Doing some digging of my own it seems an undefined
snuck into the fieldNamesRequested
array in this.getIncludes
:
[ undefined, 'isOwner', 'team.name', 'user.id' ]
Context
Please provide any relevant information about your setup.
- Package Version: 4.1.7 (lumber)
- Express Version: ~4.17.1
- Sequelize Version: ~5.15.1
- Database Dialect: Postgres
- Database Version: 12.6
- Project Name: saas-ludbac
Here’s the table I’m trying to view:
create table app_public.team_memberships (
team_id uuid references app_public.teams on delete cascade,
user_id uuid references app_public.users on delete cascade,
is_owner boolean not null default false,
unique (team_id, user_id)
);
Referenced tables:
create table app_public.teams (
id uuid primary key default gen_random_uuid(),
name citext not null
);
create table app_public.users (
id uuid primary key default gen_random_uuid(),
full_name text not null,
email citext unique not null check (email ~ '[^@]+@[^@]+\.[^@]+'),
is_verified boolean not null default false
);
It also seems like app_public.team_memberships
is not automatically recognized as a junction table as there is no belongsToMany
in models.users
.
Thanks!