passkit-generator: pass generate api stream is undefined
Hi, I am getting undefined stream on using the following code. I dont see any error in my catch either. Please help as I am relatively new to this. The stream is undefined.
app.get('/downloadpass', async (req, res, next) => {
let examplePass = new Pass({
model: "./passModels/Coupon",
certificates: {
wwdr: "./certs/wwdr.pem",
signerCert: "./certs/signerCert.pem",
signerKey: {
keyFile: "./certs/passkey.pem",
passphrase: "12345"
}
},
overrides: {
// keys to be added or overridden
serialNumber: "AAGH44625236dddaffbda"
},
// if true, existing keys added through methods get overwritten
// pushed in queue otherwise.
shouldOverwrite: true
});
// Adding some settings to be written inside pass.json
examplePass.barcode("36478105430"); // Random value
// Generate the stream, which gets returned through a Promise
try {
let stream = await examplePass.generate();
stream.pipe(res)
} catch (e) {
//this will eventually be handled by your error handling middleware
console.log(e)
}
})
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (11 by maintainers)
Thank you for your work. =)
@nikhilenmudi if you see this commit, you can see that there was a throw that I, mistakenly, forgot to re-introduce when I moved to async/await.
Oh, awesome 😂. So both projects were not working for different reasons. 😂
Yes, of course. I had the same problem.
@ksaine have you tried? I probably forgot when I separated the functions in
utils.js
. I’ll commit, push and publish it this evening if this is the problem. @ndrozd @nikhilenmudi have you tried this solution?