How to work around Sequelize not supporting composite foreign keys
I have never seen Sequelize, but your error reads:

 TypeError: Cannot read property 'toUpperCase' of undefined


Where it says of undefined I would suggest your code is trying to convert a string to uppercase, but in fact, your string is null and the conversion (toUpperCase) fails on null.

That said, I don't see toUpperCase in the query you supplied, but you have the line model:invitations - does this mean that your query is acting on some data structure (table?) called 'invitations'?

If so, I would check there for the toUpperCase function. For each instance of the function, see whether it is being called on something that might have a null value. If so, then somehow ensure you don't get a null value - for example, add filter criteria to exclude null values, or use a casting function like isNull (if it exists for you) or coalesce to replace nulls with an empty string, like this:

 coalesce(columnName, '')


Failing the above, post a little more info on what your data query really looks like, and why you think the composite foreign keys may relate to the error.