I am using Pass converter ( pass converter github link) to convert Google Pass to Apple Pass, the output is stored in the AWS S3. when a user visit the link it will download the .pkpass (naming is like this: applepass-95370f2a-cd77-4bcc-b52b-be22dff45415.pkpass). but I am getting "Safari cannot download this file" when I am using iPhone 14.
in windows by changing the user agent, it is getting downloaded
any idea how to fix this, screenshot attached below.
This is the code that sent pkpass to s3 and get back the link:
if (req.passText.charAt(0) === '{') {
try {
const pkPassBuffer = await googleToPkPass(JSON.parse(req.passText), req.fullUrl);
// Respond with the PKPass file
const params = { content: pkPassBuffer, contentType: 'application/vnd.apple.pkpass', }
const applePassUrl = await uploadToS3(params);
res.send({ msg: 'success', url: applePassUrl })
} catch (e) {
console.log(e);
}
}
const uploadToS3 = async ({ content, contentType }) => {
let random = seedrandom(`${new Date().getTime()}`)();
const keyId = uuidv4(`link/${random}`, uuidv4.URL);
const params = {
Bucket: bucket,
Key: `applepass-${keyId}.pkpass`,
Body: content,
ContentEncoding: "base64",
ContentType: contentType,
};
const uploadedfile = await s3.upload(params).promise();
return uploadedfile.Location.replace("s3.amazonaws.com/", "");
};
I used pass validator to validate the pass and it says this: screenshot from pass validator
how to solve this issue, so that i can add this pass to apple wallet
Update: I got the issue it was because of the headers since I am using aws for storing the pkpass file when I return it for download I am sending it as json content type instead of contentType: 'application/vnd.apple.pkpass',
The reason for showing error "Safari cannot download this file is mainly due to :
if the contentType of the response is not 'application/vnd.apple.pkpass' if any of the required fields are not present in pkpass file if the certificate is not valid