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: (s || "").replace is not a function #30

Closed
fragosti opened this issue Apr 29, 2020 · 8 comments · Fixed by #31
Closed

UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function #30

fragosti opened this issue Apr 29, 2020 · 8 comments · Fixed by #31
Labels

Comments

@fragosti
Copy link

Describe the bug
I get the following error when manually triggering the action. Am I configured correctly?

Run cycjimmy/semantic-release-action@v2
  with:
    dry_run: true
    semantic_version: 1.0.0
    branch: master
  env:
    GITHUB_TOKEN: ***
    DEBUG: true
added 2 packages in 0.447s

##[error]npm WARN deprecated conventional-changelog@0.0.11: Please update conventional-changelog to >1.0.0. If you are running the cli, use conventional-changelog-cli
npm WARN deprecated github@0.2.4: 'github' has been renamed to '@octokit/rest' (https://git.io/vNB11)

(node:7589) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function
    at escapeData (/home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@actions/core/lib/command.js:66:10)
    at Command.toString (/home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@actions/core/lib/command.js:60:35)
    at issueCommand (/home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@actions/core/lib/command.js:23:30)
    at Object.issue (/home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@actions/core/lib/command.js:27:5)
    at error (/home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@actions/core/lib/core.js:127:15)
    at setFailed (/home/runner/work/_actions/cycjimmy/semantic-release-action/v2/node_modules/@actions/core/lib/core.js:101:5)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:7589) 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:7589) [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.

Workflow
I specified the config in package.json

{
  "name": "0x-api",
  "version": "0.0.1",
  "description": "0x API",
  "repository": "git@github.com:0xProject/0x-api.git",
  "author": "Francesco Agosti <francesco@0x.org>",
  "license": "Apache-2.0",
  "scripts": {
      "install": "sed -ie 's!import { Provider as Web3Provider } from \"web3/providers\";!import { Web3EthereumProvider as Web3Provider } from \"web3-providers\";!' node_modules/ganache-core/typings/index.d.ts # see https://github.com/trufflesuite/ganache-core/issues/465#issuecomment-610005598",
      "clean": "yarn clean:ts && yarn clean:docker",
      "clean:ts": "shx rm -rf lib",
      "clean:docker": "shx rm -rf 0x_mesh/db",
      "build": "tsc -p tsconfig.json",
      "test": "ETHEREUM_RPC_URL=http://localhost:8545 CHAIN_ID=1337 RFQT_API_KEY_WHITELIST='koolApiKey1,koolApikey2' RFQT_MAKER_ENDPOINTS='https://mock-rfqt1.club' META_TXN_RELAY_ADDRESS=0x9eFCa436873b55a0d6AEa260f92DE50150360dca META_TXN_RELAY_PRIVATE_KEY=82b9c3b8d45f608badd8fda250a0d95088381540e850734519b659e1e1ac3e71 mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 200000 --exit",
      "dev": "nodemon -r dotenv/config src/index.ts | pino-pretty",
      "dev:service:http": "nodemon -r dotenv/config src/runners/http_service_runner.ts | pino-pretty",
      "dev:service:sra_http": "nodemon -r dotenv/config src/runners/http_sra_service_runner.ts | pino-pretty",
      "dev:service:staking_http": "nodemon -r dotenv/config src/runners/http_staking_service_runner.ts | pino-pretty",
      "dev:service:swap_http": "nodemon -r dotenv/config src/runners/http_swap_service_runner.ts | pino-pretty",
      "dev:service:order_watcher": "nodemon -r dotenv/config src/runners/order_watcher_service_runner.ts | pino-pretty",
      "watch": "tsc -w",
      "prettier": "prettier --write ${npm_package_config_prettier_target} --config .prettierrc",
      "prettier:ci": "prettier --list-different ${npm_package_config_prettier_target} --config .prettierrc",
      "start": "node -r dotenv/config lib/src/index.js",
      "start:service:http": "node -r dotenv/config lib/src/runners/http_service_runner.js",
      "start:service:sra_http": "node -r dotenv/config lib/src/runners/http_sra_service_runner.js",
      "start:service:staking_http": "node -r dotenv/config lib/src/runners/http_staking_service_runner.js",
      "start:service:swap_http": "node -r dotenv/config lib/src/runners/http_swap_service_runner.js",
      "start:service:order_watcher": "node -r dotenv/config lib/src/runners/order_watcher_service_runner.js",
      "start:service:signer": "node -r dotenv/config lib/src/runners/signer_runner.js",
      "lint": "tslint --project . --format stylish && yarn prettier:ci",
      "release": "curl -v -H \"Accept: application/vnd.github.everest-preview+json\" -H \"Authorization: token ${GITHUB_TOKEN}\" https://api.github.com/repos/0xProject/0x-api/dispatches -d '{ \"event_type\": \"semantic-release\" }'"
  },
  "config": {
      "prettier_target": "{.,test/**,src/**}/*.{ts,tsx,json,md}"
  },
  "resolutions": {
      "@0x/contract-addresses": "0xProject/gitpkg-registry#0x-contract-addresses-v4.9.0-49e4ade66",
      "@0x/contract-wrappers": "0xProject/gitpkg-registry#0x-contract-wrappers-v13.6.3-49e4ade66"
  },
  "release": {
      "plugins": [
          "@semantic-release/commit-analyzer",
          "@semantic-release/release-notes-generator",
          "@semantic-release/github"
      ]
  },
  "devDependencies": {
      "@0x/dev-utils": "^3.1.1",
      "@0x/tslint-config": "^4.0.0",
      "@0x/types": "^3.1.1",
      "@0x/typescript-typings": "^5.0.1",
      "@types/cors": "^2.8.6",
      "@types/dotenv": "^6.1.1",
      "@types/express": "^4.17.1",
      "@types/lodash": "^4.14.137",
      "@types/mocha": "^5.2.7",
      "@types/pino": "^5.8.13",
      "@types/rimraf": "^3.0.0",
      "@types/supertest": "^2.0.8",
      "@types/web3": "^1.0.19",
      "@types/ws": "^6.0.2",
      "chai": "^4.2.0",
      "chai-as-promised": "^7.1.1",
      "dirty-chai": "^2.0.1",
      "make-promises-safe": "^5.1.0",
      "mocha": "^6.2.2",
      "nodemon": "^1.19.4",
      "pino-pretty": "^3.2.2",
      "prettier": "^1.18.2",
      "rimraf": "^3.0.2",
      "shx": "^0.3.2",
      "supertest": "^4.0.2",
      "ts-node": "^8.4.1",
      "tslint": "^5.19.0",
      "typescript": "3.0.1"
  },
  "dependencies": {
      "@0x/assert": "^3.0.4",
      "@0x/asset-swapper": "0xProject/gitpkg-registry#0x-asset-swapper-v4.4.0-49e4ade66",
      "@0x/connect": "^6.0.4",
      "@0x/contract-addresses": "0xProject/gitpkg-registry#0x-contract-addresses-v4.9.0-49e4ade66",
      "@0x/contract-wrappers": "0xProject/gitpkg-registry#0x-contract-wrappers-v13.6.3-49e4ade66",
      "@0x/contracts-dev-utils": "0xProject/gitpkg-registry#0x-contracts-dev-utils-v1.3.3-110e1afa8",
      "@0x/json-schemas": "^5.0.4",
      "@0x/mesh-rpc-client": "^9.2.1",
      "@0x/order-utils": "^10.1.1",
      "@0x/subproviders": "^6.0.4",
      "@0x/types": "^3.1.1",
      "@0x/utils": "^5.2.0",
      "@0x/web3-wrapper": "^7.0.4",
      "@types/uuid": "^7.0.2",
      "@types/uuid-validate": "^0.0.1",
      "axios": "^0.19.2",
      "body-parser": "^1.19.0",
      "cors": "^2.8.5",
      "debug": "^4.1.1",
      "dotenv": "^8.1.0",
      "ethereum-types": "0xProject/gitpkg-registry#ethereum-types-v3.1.0-110e1afa8",
      "express": "^4.17.1",
      "express-async-handler": "^1.1.4",
      "http-status-codes": "^1.3.2",
      "jsonschema": "^1.2.5",
      "lodash": "^4.17.15",
      "pg": "^7.12.1",
      "pino": "^5.13.5",
      "retry-axios": "^2.1.2",
      "typeorm": "0.2.18",
      "uuid": "^7.0.3",
      "uuid-validate": "^0.0.3",
      "ws": "^7.1.2"
  }
}

Workflow file.

name: Release
on: 
    repository_dispatch:
        types: [semantic-release]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '11.x'
      - name: Install dependencies
        run: yarn install
      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v2
        with:
          dry_run: true
          semantic_version: '1.0.0'
          branch: 'master'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DEBUG: true

Expected behavior
No errors.

Additional context
Other people have run into a similar error in the core actions module.
actions/toolkit#398
All this is open source at https://github.com/0xProject/0x-api/

@cycjimmy
Copy link
Owner

I noticed that you are using a really old version of semantic-release@1.0.0. Actions may not support such an old version. Please try to re-run with version 15 or above to see if there is still a problem.

@UziTech
Copy link
Contributor

UziTech commented Apr 30, 2020

This is still a problem with semantic-release@17.0.7.

Looks like it is an issue that can be solved by updating @actions/core to v1.2.4

The actual issue is that core.setOutput v1.2.3 only accepts strings as input and some of these variables are not strings:

core.setOutput(outputs.new_release_version, version);
core.setOutput(outputs.new_release_major_version, major);
core.setOutput(outputs.new_release_minor_version, minor);
core.setOutput(outputs.new_release_patch_version, patch);
core.setOutput(outputs.new_release_notes, notes);

This is fixed in v1.2.4

@fragosti
Copy link
Author

Might be good to update the other dependencies with warnings too.

@fragosti
Copy link
Author

fragosti commented Apr 30, 2020

And @cycjimmy how do you see what version of semantic-release I'm using? All I can control is declaring cycjimmy/semantic-release-action@v2 in my workflow file.

@UziTech
Copy link
Contributor

UziTech commented Apr 30, 2020

@fragosti What other dependencies? This package only has two dependencies

@UziTech
Copy link
Contributor

UziTech commented Apr 30, 2020

how do you see what version of semantic-release I'm using?

@fragosti you pasted semantic_version: 1.0.0 in the first code block.

@fragosti
Copy link
Author

I mis-understood the docs :) Thanks! I thought I was overriding what the next release version would be.

@github-actions
Copy link

github-actions bot commented May 1, 2020

🎉 This issue has been resolved in version 2.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants