Closed teawithfruit closed 5 years ago
Hi! Thanks to you for using it! What do you mean with "overridden"? What error do you get?
If I do something like this.
let pass = new Pass({
model: 'ticket',
certificates: {
wwdr: 'wwdr.pem',
signerCert: 'signerCert.pem',
signerKey: {
keyFile: 'signerKey.pem',
passphrase: '123456'
}
},
overrides: {
serialNumber: hash,
webServiceURL: url,
authenticationToken: token
},
shouldOverwrite: true
})
webServiceURL is not being used and the pkpass file can't be opend. But if I set the parameter in the pass.json file, everything works fine.
It should be a bug, but I have to understand the reason behind this behavior. Since I'm not able to do tests right now, can you please download the generated pass, rename it from .pkpass
to .zip
, unzip it and put here the package-patched pass.json available inside? Thank you.
Sure.
{
"formatVersion": 1,
"passTypeIdentifier": "pass.net.test.ticket",
"serialNumber": "jd3bb6611a17ced10d84631b6782f367",
"teamIdentifier": "ABCDEFGHI",
"webServiceURL": "",
"authenticationToken": "fb9c32b79ff1a537cb93891cbda3eea7",
"relevantDate": "2019-11-13T00:00:00+00:00",
"locations": [
{
"longitude": -122.3748889,
"latitude": 37.6189722
},
{
"longitude": -122.03118,
"latitude": 37.33182
}
],
"organizationName": "Test",
"description": "Ticket",
"foregroundColor": "rgb(255, 255, 255)",
"backgroundColor": "rgb(60, 65, 76)",
"eventTicket": {
"primaryFields": [
{
"key": "event",
"label": "EVENT",
"value": "Test"
}
],
"secondaryFields": [
{
"key": "loc",
"label": "LOCATION",
"value": "Test"
}
],
"transitType": ""
},
"barcode": {
"message": "https://test.local.de/fb9c32b79ff1a537cb93891cbda3eea7",
"format": "PKBarcodeFormatQR",
"messageEncoding": "iso-8859-1"
},
"barcodes": [
{
"message": "https://test.local.de/fb9c32b79ff1a537cb93891cbda3eea7",
"format": "PKBarcodeFormatQR",
"messageEncoding": "iso-8859-1"
}
]
}
Unfortunately the webServiceURL
field is empty.
Are you sure url
variable you are putting in overrides has content? Just to not exclude anything.
I'll investigate asap. There may be problems with schema validation.
Yes, I'm sure. I've checked it a minute ago.
Thank you for your very quick response!
Okay! I'll try to investigate this evening (GMT+1). Thank you for your patience.
You are free to make some tests too since you already have a web server setted.
Have you tried to execute the node
process with the flag DEBUG=*
as specified in the API Reference? It may give us more informations about the problem. Let me know.
I had a moment and tried to execute a fast test. webServiceURL failed the regex validation and got this error:
Schema validation failed due to error: child "webServiceURL" fails because ["webServiceURL" with value "https://google.com" fails to match the required pattern: /^https?:\/\/(?:[a-z0-9]+\.[a-z0-9]+\.[a-z]+(?:\.[a-z]+)?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/?(?:[a-z\/_%0-9A-Z.]+)?/]
I have to understand what regex put inside there or what to fix.
I created a new regex:
https?:\/\/(?:(?:[a-z0-9]+\.?)+(?::\d)?(?:\/[\S]+)*)*
Can you please try to replace the current regex in your local schema.js
, as below, and test again if it works?
webServiceURL: Joi.string().regex(/https?:\/\/(?:(?:[a-z0-9]+\.?)+(?::\d)?(?:\/[\S]+)*)*/),
Validation may give another error about the required "authenticationToken" but you can ignore it right now (I already fixed it, I'll publish the fix with the next update).
Thank's again for your quick response.
I did a bit more debugging and I found out, that webServiceURL
do not pass if authenticationToken
is set inside the schema file. If I remove the following lines, it also works with the old webServiceURL
regex.
authenticationToken: Joi.string().token().min(16).when("webServiceURL", {
is: Joi.exist(),
then: Joi.required()
}),
In fact I'm going to change the approach to verify if both are available, in the next update. I'll release an update this afternoon or this evening in a new branch called "bugfix". I'll update you there once done and you'll have to try to use that and tell me if it fixed the issue, okay? If done I'll publish the update on NPM.
Okay @teawithfruit, I've pushed to a new branch bugfix. Try with this version and let me know 👍
Hi @teawithfruit, any news?
Sorry for the late response. Yes, I've tested it and it's working now. Thank you!
Hello.
Thanks for this cool package! Is it a bug or a feature, that it is not possible to
webServiceURL
overridden?Thanks