From 598a9be384dedc07c0cf8fd7170ae83d4778b312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Sol=C3=A1r?= Date: Mon, 30 Nov 2026 15:44:56 +0100 Subject: [PATCH] ci: surface hidden CLI errors in test jobs (debug, do not merge) Co-Authored-By: Claude Fable 5.2 --- .github/workflows/check.yaml | 19 +++++++++++++++++++ src/commands/create.ts | 2 +- src/lib/command-framework/apify-command.ts | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 4a9dae439..c32738342 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -104,8 +104,15 @@ jobs: python-version: 3.14 - name: Run local tests + env: + APIFY_CLI_DEBUG_ERROR_FILE: ${{ github.workspace }}/cli-debug-errors.log run: pnpm run test:local + - name: Print hidden CLI errors (debug) + if: ${{ always() }} + shell: bash + run: cat cli-debug-errors.log 2>/dev/null || echo "No CLI errors recorded" + test_api: if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }} @@ -134,8 +141,14 @@ jobs: - name: Run API tests env: TEST_USER_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }} + APIFY_CLI_DEBUG_ERROR_FILE: ${{ github.workspace }}/cli-debug-errors.log run: pnpm run test:api + - name: Print hidden CLI errors (debug) + if: ${{ always() }} + shell: bash + run: cat cli-debug-errors.log 2>/dev/null || echo "No CLI errors recorded" + test_python_support: if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[docs build]') }} @@ -175,8 +188,14 @@ jobs: - name: Run Python tests env: TEST_USER_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }} + APIFY_CLI_DEBUG_ERROR_FILE: ${{ github.workspace }}/cli-debug-errors.log run: pnpm run test:python + - name: Print hidden CLI errors (debug) + if: ${{ always() }} + shell: bash + run: cat cli-debug-errors.log 2>/dev/null || echo "No CLI errors recorded" + # Aggregate gate for the whole Python Support matrix. Branch protection requires only this single # check, so the matrix versions can change without having to update the required checks in lockstep. test_python_support_result: diff --git a/src/commands/create.ts b/src/commands/create.ts index a0f959169..c8ed56128 100644 --- a/src/commands/create.ts +++ b/src/commands/create.ts @@ -217,7 +217,7 @@ export class CreateCommand extends ApifyCommand { // Start fetching manifest immediately to prevent // annoying delays that sometimes happen on CLI startup. const manifestPromise = fetchManifest().catch((err) => { - return new Error(`Could not fetch template list from server. Cause: ${err?.message}`); + return new Error(`Could not fetch template list from server. Cause: ${err?.message}`, { cause: err }); }); actorName = await ensureValidActorName(actorName); diff --git a/src/lib/command-framework/apify-command.ts b/src/lib/command-framework/apify-command.ts index 2488c857f..cff6edb1b 100644 --- a/src/lib/command-framework/apify-command.ts +++ b/src/lib/command-framework/apify-command.ts @@ -1,7 +1,9 @@ /* eslint-disable max-classes-per-file */ +import { appendFileSync } from 'node:fs'; import process from 'node:process'; import type { parseArgs, ParseArgsConfig, ParseArgsOptionDescriptor } from 'node:util'; +import { inspect } from 'node:util'; import type { Awaitable } from '@crawlee/types'; import chalk from 'chalk'; @@ -412,6 +414,18 @@ export abstract class ApifyCommand