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

TypeError on Node 19 #379

Closed
estensen opened this issue Jan 10, 2023 · 5 comments
Closed

TypeError on Node 19 #379

estensen opened this issue Jan 10, 2023 · 5 comments

Comments

@estensen
Copy link

Having some problems after installing Node 19. This worked before on Node 16
Using httpyac version 5.8.2

# Refresh user token
POST xxx
Authorization: Bearer {{deviceToken}}

{{
  test.status(200);
  exports.userToken = response.body;
}}
TypeError [ERR_INVALID_THIS]: Value of "this" must be of type nullish or must be the global object
    at new NodeError (node:internal/errors:399:5)
    at global.cryptoThisCheck (node:internal/process/pre_execution:288:17)
    at get crypto [as crypto] (node:internal/util:564:9)
    at Iu (/usr/local/lib/node_modules/httpyac/dist/index.js:3:44002)
    at St (/usr/local/lib/node_modules/httpyac/dist/index.js:3:43777)
    at et (/usr/local/lib/node_modules/httpyac/dist/index.js:3:47009)
    at Object.action (/usr/local/lib/node_modules/httpyac/dist/index.js:3:46342)
    at b.<anonymous> (/usr/local/lib/node_modules/httpyac/node_modules/hookpoint/dist/index.js:1:3786)
    at Generator.next (<anonymous>)
    at d (/usr/local/lib/node_modules/httpyac/node_modules/hookpoint/dist/index.js:1:1162) {
  code: 'ERR_INVALID_THIS'
}
@AnWeber
Copy link
Owner

AnWeber commented Jan 10, 2023

Thanks for the tip. I'll see what I can do there. To have the variables directly accessible, I create my own Global Context and add the NodeJs methods there. This explains quite well the ERR_INVALID_THIS. Let's see what all I have to adjust.

AnWeber added a commit that referenced this issue Jan 10, 2023
AnWeber added a commit that referenced this issue Jan 10, 2023
@AnWeber
Copy link
Owner

AnWeber commented Jan 10, 2023

The local execution looks good now, but the unit tests still fail. This seems to be a bug of mockttp (httptoolkit/mockttp#107) though.
If it's not urgent, I won't make a separate release now, but update it with the next release. Transitionally the use of the Docker image would go (see https://httpyac.github.io/guide/installation_docker.html)

@estensen
Copy link
Author

estensen commented Jan 11, 2023

It's not urgent. I'm just pinning node:16 in my pipelines. Thanks for taking a look 🙌

@AnWeber
Copy link
Owner

AnWeber commented Jan 22, 2023

Hi I forgot about the issue. I released an update. Please retest it. It should be fixed. Thanks

@AnWeber AnWeber closed this as completed Jan 22, 2023
@estensen
Copy link
Author

Confirm that it works for node:18. Thanks for fixing it so quickly!

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

2 participants