Skip to content

ERR_LOADER_CHAIN_INCOMPLETE in CI, works locally in a Dev Container #22795

Closed
@brianjenkins94

Description

@brianjenkins94

Current behavior

Stacktrace:

Error [ERR_LOADER_CHAIN_INCOMPLETE]: "file:///root/.cache/Cypress/10.3.0/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
    at new NodeError (node:internal/errors:387:5)
    at ESMLoader.resolve (node:internal/modules/esm/loader:860:13)
    at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:439:7)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:541:24)
    at async loadESM (node:internal/process/esm_loader:83:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12) {
  code: 'ERR_LOADER_CHAIN_INCOMPLETE'

I noticed this too:

libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[1395:0714/145055.804094:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[1395:0714/145055.807765:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

But otherwise didn't find any useful search results when searching for "ERR_LOADER_CHAIN_INCOMPLETE" so I'm going to file this so I can answer it when I figure it out :)

Desired behavior

Don't short circuit on resolve.

Test code to reproduce

Not sure yet... I'm going to start by trying v10.2.* because it only recently stopped working in CI, so maybe it broke with v10.2.*.

I am using this .gitlab-ci.yml:

{
  "image": "mcr.microsoft.com/playwright:latest",
  "before_script": [
    "# Node.js v18",
    "apt-get remove nodejs -y",
    "apt-get update",
    "apt-get install -y curl",
    "curl -fsSL https://deb.nodesource.com/setup_18.x | bash -",
    "apt-get install -y nodejs",
    "npm install",
    "# SSH",
    "eval $(ssh-agent -s)",
    "echo \"$SSH_PRIVATE_KEY\" | ssh-add -",
    "mkdir -p ~/.ssh",
    "chmod 700 ~/.ssh",
    "ssh-keyscan host.docker.internal >> ~/.ssh/known_hosts",
    "chmod 644 ~/.ssh/known_hosts"
  ],
  "stages": [
    "build",
    "confidence-check"
  ],
  "pages": {
    "stage": "build",
    "script": [
      "npm run cypress",
      "npm run cypress-static",
      "rm -rf public",
      "mv out public"
    ],
    "artifacts": {
      "paths": [
        "public"
      ]
    },
    "only": [
      "main"
    ]
  },
  "e2e": {
    "stage": "confidence-check",
    "script": [
      "npx cypress run --config baseUrl=$CI_PAGES_URL"
    ],
    "only": [
      "main"
    ]
  }
}

and here are the relevant scripts from my package.json, which are a bit gnarly:

{
  "scripts": {
    "cypress": "CODE=0 ; (npm start & { npx cypress run ; CODE=$? ; kill -INT $(jobs -p) ; }) ; (exit $CODE)",
    "cypress-static": "CODE=0 ; npm run build && (npm run serve & { npx cypress run --config baseUrl=http://localhost:8080/ ; CODE=$? ; kill -INT $(jobs -p) ; }) ; (exit $CODE)",
    "build": "next build && npm run postbuild && next export && npm run postexport",
    "postbuild": "node --experimental-specifier-resolution=node --loader=ts-node/esm scripts/postbuild.ts",
    "postexport": "node --experimental-specifier-resolution=node --loader=ts-node/esm scripts/postexport.ts",
    "serve": "npx http-server . -c-1",
    "start": "node --experimental-specifier-resolution=node --loader=ts-node/esm server.ts"
  }
}

and my cypress.config.ts, even though it's pretty plain:

import { defineConfig } from "cypress";

export default defineConfig({
	"e2e": {
		"baseUrl": "http://localhost:3000/",
		"setupNodeEvents": function(on, config) {
			// Implement node event listeners here
		}
	},
	"video": false,
	"viewportHeight": 1080,
	"viewportWidth": 1920
});

Cypress Version

v10.3.0

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions