Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MarkLyck opened this issue Feb 27, 2021 · 7 comments

Comments

@MarkLyck
Copy link

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/[email protected]
Loaded [email protected] 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/[email protected]

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

My Typescript version on both projects are 4.1.5 (exact)

@MarkLyck
Copy link
Author

MarkLyck commented Mar 2, 2021

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
Copy link
Author

MarkLyck commented Mar 2, 2021

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
Copy link

ypresto commented Mar 6, 2021

Try this until #22 is merged?

- uses: ypresto/typescript-error-reporter-action@6cb6a970f0783c19f55fb83079f7846a583c7543

@MarkLyck
Copy link
Author

MarkLyck commented Mar 8, 2021

@ypresto

Getting the following error when running your fork:

Run ypresto/typescript-error-reporter-action@6cb6a970f0783c19f55fb83079f7846a583c7543
Loaded [email protected] 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
Copy link

This looks like a dup of #13

@Gozala 's fork fixed this issue for me:

    - name: Typecheck
      uses: gozala/[email protected]

@KylerHansen
Copy link

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

@knitevision1
Copy link

Worth noting:

  • It started to happen when using target: ['ES2021'] in tsconfig
  • None of the attempted fix worked
  • Opted in using npx tsc --noEmit instead of this custom action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants