question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: UnhandledPromiseRejection in posthog-node 2.2.1

See original GitHub issue

What happened?

When I run the test using the stepci CLI, the test itself succeeds, but then I get an error UnhandledPromiseRejection.

$ stepci run ./workflow.yml
 PASS  example

Tests: 0 failed, 1 passed, 1 total
Steps: 0 failed, 1 passed, 1 total
Time:  0.109s, estimated 0s

Workflow passed after 0.109s
Give us your feedback on https://step.ci/feedback
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "CanceledError: canceled".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

workflow.yml:

version: "1.1"
name: Validating JSON

config:
  http:
    baseURL: https://jsonplaceholder.typicode.com

env:
  postId: "2"

tests:
  example:
    steps:
      - name: GET request
        http:
          url: /posts/${{env.postId}}
          method: GET
          check:
            status: 200
            jsonpath:
              $.id: ${{env.postId}}
              $.userId: 1

The same error occurs when using github actions. logs: https://github.com/koki-develop/stepci-example/actions/runs/3551276044/jobs/5965323631 .github/workflows/main.yml:

name: api test

on:
  push:

jobs:
  with-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: stepci/stepci@main
        with:
          workflow: workflow.yml

This error does not occur when using @stepci/runner, so there may be some problem with stepci cli. The workflow below uses @stepci/runner in vitest, but no error occurs.

logs: https://github.com/koki-develop/stepci-example/actions/runs/3551276044/jobs/5965323586

What did you expect to happen?

After the test is completed, it ends without error as it is.

Version

2.5.1

Environment

Node v16.18.1

How can we reproduce this bug?

commands:

$ git clone git@github.com:koki-develop/stepci-example.git
$ cd stepci-example
$ stepci run ./workflow.yml

output:

 PASS  example

Tests: 0 failed, 1 passed, 1 total
Steps: 0 failed, 1 passed, 1 total
Time:  0.132s, estimated 0s

Workflow passed after 0.132s
Give us your feedback on https://step.ci/feedback
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "CanceledError: canceled".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

exit code:

$ echo $?
1

Relevant log output

PASS  example

Tests: 0 failed, 1 passed, 1 total
Steps: 0 failed, 1 passed, 1 total
Time:  0.132s, estimated 0s

Workflow passed after 0.132s
Give us your feedback on https://step.ci/feedback
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "CanceledError: canceled".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Would you be interested in working on a bugfix for this issue?

  • Yes! Assign me

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

3reactions
mishushakovcommented, Nov 28, 2022

Done, thank you so much! Now you’re one of us, officially: https://github.com/stepci/stepci/graphs/contributors

😍

2reactions
mishushakovcommented, Nov 27, 2022

No worries, I’ll fill the report and reference you there. Please update stepci to 2.5.5 Thanks for looking into it 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is an unhandled promise rejection? - Stack Overflow
I am getting an error like this: (node:4796) UnhandledPromiseRejectionWarning: Unhandled promise rejection (r ejection id: 1): ...
Read more >
Unhandled Promise Rejections in Node.js - The Code Barbarian
What is an Unhandled Rejection? "Rejection" is the canonical term for a promise reporting an error. As defined in ES6, a promise is...
Read more >
Auth attributes_required error not caught · Issue #9347 - GitHub
I have read the guide for submitting bug reports. ... This throws an unhandled error which crashes the page. next-dev.js?3515:32 [ERROR] ...
Read more >
Node.js - Docs - PostHog
Note: Whenever we face an error computing the flag, the library returns undefined , instead of true , false , or a string...
Read more >
Making unhandled promise rejections crash the Node.js process
I want my code to fail loudly when there is an unexpected error. It's usually bad when uncaught errors go unnoticed as it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found