Fix sdk-e2e-test: ensure DB is ready before server starts (#19583)
## Summary
- The `sdk-e2e-test` CI job has been failing since at least April 9th
because the nx dependency graph runs `database:reset` and
`start:ci-if-needed` in **parallel** — neither depends on the other. The
server starts before the DB tables are created, crashes with `relation
"core.keyValuePair" does not exist`, and `wait-on` times out after 10
minutes.
- Replace the `nx-affected` orchestration for e2e with explicit
**sequential** CI steps: build → create DB → reset DB → start server →
wait for health → run tests.
- Add server log dump on failure for easier future debugging.
## Root cause
In `packages/twenty-sdk/project.json`, the `test:e2e` target has:
```json
"dependsOn": [
"build",
{ "target": "database:reset", "projects": "twenty-server" },
{ "target": "start:ci-if-needed", "projects": "twenty-server" }
]
```
Since `database:reset` and `start:ci-if-needed` don't depend on each
other, nx can (and does) run them concurrently. `start:ci-if-needed`
fires `nohup nest start &` and immediately completes. The server process
tries to query `core.keyValuePair` before `database:reset` creates it →
crash → wait-on timeout → job failure.
This commit is contained in:
@@ -56,14 +56,19 @@ vi.mock('@/cli/utilities/file/file-uploader', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@/cli/utilities/auth/resolve-app-access-token', () => ({
|
||||
ensureValidAppAccessTokenOrRefresh: vi
|
||||
vi.mock('@/cli/utilities/auth', () => ({
|
||||
ensureAppAccessTokenIsValidOrRefresh: vi
|
||||
.fn()
|
||||
.mockResolvedValue('mock-app-access-token'),
|
||||
exchangeCredentialsForTokens: vi.fn().mockResolvedValue({
|
||||
accessToken: 'mock-app-access-token',
|
||||
refreshToken: 'mock-app-refresh-token',
|
||||
}),
|
||||
ensureAppRegistration: vi.fn().mockResolvedValue({
|
||||
clientId: 'mock-client-id',
|
||||
clientSecret: 'mock-client-secret',
|
||||
isNewRegistration: true,
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@/cli/utilities/client/client-service', () => ({
|
||||
|
||||
Reference in New Issue
Block a user