Skip to content

toSorted() issue even with Node 23 #17

@eatplaysleep

Description

@eatplaysleep

Summary*

We require Node 22+ in the lab. toSorted() should be available in Node 23. However, Matt Plant ran into the following error when the app attempts to create mock accounts:

fetching profile...
Creating mock accounts for user: auth0|68e63fda02800bc991063afe
 ⨯ TypeError: [(...array)].toSorted is not a function
    at sortBy (lib/utils/index.ts:19:20)
    at getSystemPrompt (lib/ai/agents/step-guru.ts:8:30)
    at async (lib/ai/agents/step-guru.ts:26:10)
  17 | ) {
  18 |  const dir = order === 'asc' ? 1 : -1;
> 19 |  return [...array].toSorted((a: T, b: T) => {
     |                    ^
  20 |          const av = a[key] as any;
  21 |          const bv = b[key] as any;
  22 | {
  page: '/api/chat/01K71PJXV41AVDRSZ22GT50DHC'
}
 GET /api/me 200 in 1434ms

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions