Closed omariosman closed 10 months ago
@omariosman could you share the following?
testing
or production
text file
or plain text
I've been testing this morning with SDK v5.0.1 without issue generating tokens so those will help us look into it. Thanks!
Thanks, @omariosman, that's helpful.
npm list bitpay-sdk
shows bitpay-sdk@5.0.1
? This should show what is being locked.I've been testing with Node 16 and 18 but have yet to run into an issue.
Thanks @bobbrodie for your patience! I appreciate it
REDACTED
Awesome, thanks again for stepping through this @omariosman. One last thing here. When we see Unexpected token <
, that usually means the response was starting with HTML, and the opening character is <
because it's the start of <!DOCTYPE html>
or <html>
which is definitely unexpected.
Are you able to log the response body out to your console and drop it here? That will help us understand a bit more about what you're receiving.
Sure thing! @bobbrodie. Here are the values of the response and result variables respectively.
REDACTED
Hey @omariosman thank you so much -- I've redacted the images just so nobody takes any of the info and spams with your tokens. It looks like the full response wasn't captured, but we can keep going with additional steps. We should be able to sort this out with you.
I'm wondering if there might be a network issue, and we'll need some info that would be best to keep off GitHub comments just so if we get a good response, nobody will claim the token.
If you can update your BitPaySetup.js file to log the full text of the response from both token generation functions (requestMerchantToken
and requestPayoutToken
), then reach out to integrations@bitpay.com, we can work with you on this. Please mention Node.js SDK GitHub issue #99 and that we've been talking and I'll help pick it up from there.
Thanks!
We got the problem now Bitpay is not supported in our region so we had to open a VPN to get the correct response
The response that we were getting before was actually the html page of the Access Denied page, as you said:
Unexpected token <, that usually means the response was starting with HTML, and the opening character is < because it's the start of <!DOCTYPE html> or which is definitely unexpected.
Thank you for your time in debugging this issue!
I was curious if that might be it, thank you so much for letting me know! If you need anything else please feel free to reach out :)
When I run: node node_modules/bitpay-sdk/dist/setup/BitPaySetup.js I encounter this error:
When I tried to debug the problem I found out that the result variable at the following code snippet does not have a "data" property So it throws an error
I tried to solve the error by shifting up these lines inside the .then block so the config file was generated with a private key but with empty Api tokens. The pairing codes are not printed to the console as well.