Bug 1811886

Summary: ts-loader can use wrong tsconfig.json during builds, causing various runtime errors in console
Product: OpenShift Container Platform Reporter: Yadan Pei <yapei>
Component: Management ConsoleAssignee: Samuel Padgett <spadgett>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: urgent Docs Contact:
Priority: high    
Version: 4.3.zCC: anarayan, aos-bugs, bpeterse, dtaylor, ebenahar, fbalak, jdelft, jokerman, rnetser, spadgett, sponnaga, tjelinek, vlaad, xiaocwan, yapei
Target Milestone: ---Keywords: Regression, TestBlocker
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
A bug in OpenShift console builds could occasionally result in runtime errors on certain pages. The bug has since been fixed.
Story Points: ---
Clone Of:
: 1818978 (view as bug list) Environment:
Last Closed: 2020-07-13 17:19:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1818978    

Description Yadan Pei 2020-03-10 03:38:47 UTC
Description of problem:
"invalid array length" JS error in admin console, most page can't be loaded

Version-Release number of selected component (if applicable):
4.3.0-0.nightly-2020-03-09-200240

How reproducible:
Always

Steps to Reproduce:
1. cluster admin logins to admin console

Actual results:
1. "invalid array length" error in js console, most pages can not be loaded

RangeError: "invalid array length"
    a main-chunk-bde0e19d70604dd3473b.min.js:1
    getResources main-chunk-bde0e19d70604dd3473b.min.js:1
backend.js:6:2315

Expected results:
1. console should be loaded without error 

Additional info:

Comment 1 Wei Sun 2020-03-10 10:40:47 UTC
*** Bug 1811947 has been marked as a duplicate of this bug. ***

Comment 7 Yadan Pei 2020-03-16 08:49:44 UTC
Hi Sam,

The issue no longer reproduces on 4.3.0-0.nightly-2020-03-15-112942, did we changed anything to make it work? I saw the attached PR #4706 is closed

Comment 9 Tomas Jelinek 2020-03-23 06:37:26 UTC
*** Bug 1815068 has been marked as a duplicate of this bug. ***

Comment 10 Tomas Jelinek 2020-03-23 12:08:26 UTC
Please note that a different incarnation of the same issue happened also on 4.4.0-rc.1 and rc.2 (https://bugzilla.redhat.com/show_bug.cgi?id=1815068). The nightly close to this RC build (4.4.0-0.nightly-2020-03-11-212258) worked well though. So the issue seems to be still appearing.

Comment 11 Samuel Padgett 2020-03-24 15:57:38 UTC
*** Bug 1815558 has been marked as a duplicate of this bug. ***

Comment 13 Samuel Padgett 2020-03-25 13:09:23 UTC
*** Bug 1805118 has been marked as a duplicate of this bug. ***

Comment 14 Samuel Padgett 2020-03-27 17:57:34 UTC
We've been able to reproduce with this script. The key is deleting the .cache-loader directory between builds:

#!/bin/bash

set -euo pipefail

cd frontend
rm -rf public/dist

for i in {1..100}
do
    echo "#### Running build #$i..."
    rm -rf .cache-loader
    yarn run build > "build-$i.out" 2>&1
    if grep -F -l __spreadArrays public/dist/*.min.js; then
        echo "Found unexpected __spreadArrays!"
        exit 1
    fi
done

Comment 15 Samuel Padgett 2020-03-30 17:27:33 UTC
We've discovered that this is happening because we have two tsconfig.json files, one top-level and one for the topology package. ts-loader was picking up the wrong tsconfig.json in some cases. The topology version did not have `downlevelIteration` set, and they have different `target` values in master as well.

https://github.com/TypeStrong/ts-loader/issues/647

Comment 21 Yadan Pei 2020-04-03 02:27:28 UTC
Adding `Dependent Products` value back

Comment 22 Samuel Padgett 2020-04-06 18:21:21 UTC
*** Bug 1812622 has been marked as a duplicate of this bug. ***

Comment 24 errata-xmlrpc 2020-07-13 17:19:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2409