andoshin11 / typescript-error-reporter-action

GitHub Action to diagnose TypeScript errors and report the result on PR.
MIT License
65 stars 19 forks source link

UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function #21

Open MarkLyck opened 3 years ago

MarkLyck commented 3 years ago

I'm able to use this typescript-error-reporter-action fine on one of my create-react-app projects.

I just added the exact same workflow file to another project of mine based on next.js and the next.js one gets the following error:

Run andoshin11/typescript-error-reporter-action@v1.0.2
Loaded typescript@4.1.5 from CDN.
(node:2827) UnhandledPromiseRejectionWarning: TypeError: (e || "").replace is not a function
    at /home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:2442770
    at o.toString (/home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:2442832)
    at i (/home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:2442199)
    at Object.n.issue (/home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:2442259)
    at l (/home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:4067317)
    at Object.n.setFailed (/home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:4068058)
    at /home/runner/work/_actions/andoshin11/typescript-error-reporter-action/v1.0.2/dist/index.js:16:4043297
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2827) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2827) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My workflow file:

name: Typescript

on: [push]

jobs:
  typecheck:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - name: Restore node_modules cache
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: node_modules-${{ hashFiles('**/yarn.lock') }}
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Typecheck
        uses: andoshin11/typescript-error-reporter-action@v1.0.2

My project builds fine, and running yarn tsc finds no errors.

My Typescript version on both projects are 4.1.5 (exact)

MarkLyck commented 3 years ago

Hmmm I think I figured out what's causing this bug to happen @andoshin11.

It's related to adding @ant-design/charts npm package to my code.

even though this package has Typescript and no typescript errors are thrown when running it in the browser, or running yarn tsc

as soon as I added this chart library to my other project, your typescript-error-reporter-action is now failing with this same error on both of my projects.

I have been forced to remove it, which is sad cause it is one of my favorite CI actions.

any idea what's going on with this error?

MarkLyck commented 3 years ago

Found the piece of code that's causing issues in your dist bundle. But I couldn't find the original source of the problem :(

Screen Shot 2021-03-02 at 15 43 06
ypresto commented 3 years ago

Try this until #22 is merged?

- uses: ypresto/typescript-error-reporter-action@6cb6a970f0783c19f55fb83079f7846a583c7543
MarkLyck commented 3 years ago

@ypresto

Getting the following error when running your fork:

Run ypresto/typescript-error-reporter-action@6cb6a970f0783c19f55fb83079f7846a583c7543
Loaded typescript@4.2.3 from CDN.
Error: ReferenceError: hNd is not defined

My project builds just fine, and running yarn tsc finds no errors locally.

I don't have anything called "hNd" in my code, so not sure where this is coming from.

computerjazz commented 3 years ago

This looks like a dup of https://github.com/andoshin11/typescript-error-reporter-action/issues/13

@Gozala 's fork fixed this issue for me:

    - name: Typecheck
      uses: gozala/typescript-error-reporter-action@v1.0.5
KylerHansen commented 3 years ago

I had the same issue and still can't seem to get it working. I tried #22 and #13

knitevision1 commented 1 year ago

Worth noting: