[Bug]: Error parsing reponse when using NFC Plugin
See original GitHub issueWhat is your BTCPay version?
v1.6.10.0 + LNURL NFC Support v1.0.4.0
How did you deploy BTCPay Server?
Lunanode automatic deployment
What happened?
If I pay with LNURLw NFC or LNURLw, the BTCPayServer send error code 500 even when the payment is successful and the NFC plugin struggles with parsing the response and the alert at the end is triggered in the try/catch at the bottom of lnurlwnfc.js. The payment is successful but it is annoying to close the javascript alert every time.
I hardly found the source code there https://github.com/Kukks/btcpayserver/tree/plugins/collection/Plugins/BTCPayServer.Plugins.NFC
`sendData: function (lnurl) {
this.submitting = true;
//Post LNURLW data to server
var xhr = new XMLHttpRequest()
xhr.open('POST', window.lnurlWithdrawSubmitUrl, true)
xhr.setRequestHeader('Content-Type', 'application/json')
xhr.send(JSON.stringify({lnurl, destination: this.$parent.srvModel.btcAddress}))
const self = this;
//User feedback, reset on failure
xhr.onload = function () {
if (xhr.readyState === xhr.DONE) {
console.log(xhr.response);
console.log(xhr.responseText);
self.scanning = false;
self.submitting = false;
if(self.readerAbortController) {
self.readerAbortController.abort()
}
try {
var data = JSON.parse(xhr.response)
if(data && data.status == "ERROR") {
alert(data.reason)
}
} catch (err) {
alert("Error parsing response.")
}
}
}
}`
How did you encounter this bug?
- Created a btcpayserver invoce via Keypad only app
- Tried to pay via (NFC) LNURLw tag
- Payment is successful but the alert appeared
Relevant log output
No response
What browser do you use?
Safari 16.0
Additional information
Are you sure this is a bug report?
- I confirm this is a bug report
Issue Analytics
- State:
- Created a year ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
phonegap's nfc plugin object is throwing exception in one ...
2 Answers. If you're using Cordova, and installed the plugin with cordova plugin add phonegap-nfc , Cordova will create a global variable nfc...
Read more >Core NFC | Apple Developer Forums
I am able to use NFCTagReaderSession polling for .iso15693 which correctly detects the tags and then have had to roll my own NDEF...
Read more >NFC basics
This document describes the basic NFC tasks you perform in Android. It explains how to send and receive NFC data in the form...
Read more >brew update/brew upgrade failing with Error: Not a ...
On some scheduled jobs on macOS, since few days the brew update and brew upgrade are failing. Area for Triage: Question, Bug, or...
Read more >pokusew/nfc-pcsc: Easy reading and writing ...
Easy reading and writing NFC tags and cards in Node.js - GitHub ... TypeError: NFC is not a constructor; Transaction failed error when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update the plugin, in 1.0.4.0 there is the bug we discussed earier.
That can’t be as it runs the same code 😅 Must be some caching issue on the device…