Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Working PassKit After Generated #207

Closed
AzPsu opened this issue Jun 27, 2024 · 22 comments
Closed

Not Working PassKit After Generated #207

AzPsu opened this issue Jun 27, 2024 · 22 comments

Comments

@AzPsu
Copy link

AzPsu commented Jun 27, 2024

My Code in Serverless JS

          PKPass.from({
              model: "./model/mycard.pass",
              certificates: {
                wwdr: fs.fs.readFileSync(myEnv.parsed.WWDR),
                signerCert: fs.fs.readFileSync(myEnv.parsed.SIGNCERT),
                signerKey: fs.fs.readFileSync(myEnv.parsed.SIGNKEY),
                signerKeyPassphrase: myEnv.parsed.PASSPHRASE,
          
                  const resp = await axios.get(request.body.thumbnail,
                      {responseType: "arraybuffer"});
                  const buffer = Buffer.from(resp.data, "utf-8");
                  newPass.addBuffer("./model/mycard.pass/logo.png", buffer);
   

Result in App Flutter, Logs

MyAPP: PassKit: PasskitPass(1, null, null, PasskitStructure([PasskitField(Dpt, Dpt., Test, null), PasskitField(Role, Role, Testطبيقات, null)], [PasskitField(id, ID, Pass1, null)], [PasskitField(ex, Ex, 8421, null)], [PasskitField(email, EMAIL, [email protected], null)], [PasskitField(name, Name, Test, Test, null)], null), null, null, pass.com.example.test, TST, 9J3UO23HHN, Color(0xfffd7b23), Color(0xff000000), Color(0xff000000), PPP, http://localhost:5000/test-50a6b/us-central1/pass, 0000001, CQYDVQQGEwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK6JWEdT, null, null, null, null, null, [email protected], null, null, null, null)
flutter: INFO🔷 | MyAPP: Add pass result: false

@alexandercerutti
Copy link
Owner

Hi @AzPsu, thank's for using passkit-generator!

I'm not sure what is going on here. I never used Flutter to do this thing, so I'm not sure I can help you.

What I can suggest you, if you have a Mac, is to try to download and open the pass from your mac and check if you can open it.

By doing that thing, we can start to exclude things like "its the application" or "it's the pass".

Then, I would check the Console.app to check for any logs. To navigate in the Console.app, in the wiki I've written a guide for that.

Let me know.

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

Thanks for resposnse @alexandercerutti , I checked on my Mac is doesn't open PassKit, please If can review my code JS only.

I used firebase, and I run emulator I can't see any logs and status request is 200OK, this is res body:

I don't have any error, but still not responding Mac also iPhone for open PassKit.

Can give me any help about that's, thanks.

@alexandercerutti
Copy link
Owner

Okay so, even if I highly suggest you to not print that thing here (just for a matter of reading), A zip file is being served correctly. Could be a validation issue of the pass.

You need to open Console.app and check for any logs. Start with logs coming from your Mac.

Let me know.

@alexandercerutti
Copy link
Owner

alexandercerutti commented Jun 27, 2024

BTW, after formatting your message, I wanted to let you know that you seem to not be correctly overriding the fields value and some other things. You can see there are still the placeholders in there.

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

This is logs for request on function cloud :

`2024-06-27 14:57:23.933 AST
pass6dakme70axx9 Function execution started
{
ancestorInternalIds: [1]
insertId: "j5baeof2s5hmh"
internalId: {1}
internalMetadata: {8}
labels: {2}
logName: "projects/psuapp-51a6b/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
receiveLocation: "us-central1"
receiveTimestamp: "2024-06-27T11:57:23.940261041Z"
resource: {2}
severity: "DEBUG"
textPayload: "Function execution started"
timestamp: "2024-06-27T11:57:23.933497035Z"
trace: "projects/psuapp-51a6b/traces/d635fa1f0d4a5fc63e0b7ad91bb03708"
traceSampled: false
writerEmailAddress: "[email protected]"
}

2024-06-27 14:57:26.886 AST
pass6dakme70axx9 Function execution took 2953 ms, finished with status code: 200
Open in Logs Explorer
{
ancestorInternalIds: [1]
insertId: "18ec0sdesd5bn"
internalId: {1}
internalMetadata: {8}
labels: {2}
logName: "projects/psuapp-51a6b/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
receiveLocation: "us-central1"
receiveTimestamp: "2024-06-27T11:57:26.938668453Z"
resource: {2}
severity: "DEBUG"
textPayload: "Function execution took 2953 ms, finished with status code: 200"
timestamp: "2024-06-27T11:57:26.886989195Z"
trace: "projects/psuapp-51a6b/traces/d635fa1f0d4a5fc63e0b7ad91bb03708"
traceSampled: false
writerEmailAddress: "[email protected]"
}`

And if you can help me how o extract logs from Mac when open PassKit

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

BTW, after formatting your message, I wanted to let you know that you seem to not be correctly overriding the fields value and some other things. You can see there are still the placeholders in there.

How can help for fix it this ?

@alexandercerutti
Copy link
Owner

As I told you, there's a guide in the wiki about that.

I cannot link it to you right now, sorry

@alexandercerutti
Copy link
Owner

How can help for fix it this ?

Don't know. Either you set the fields through passkit-generator or do a replace for those fields on pass.json.

I don't know if those placeholders are hardcoded or what

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

This is pass.json :

{ "formatVersion": 1, "passTypeIdentifier": "test.test.test", "teamIdentifier": "4S8PM23HHN", "organizationName": "ORG", "description": "ID Memeber", "foregroundColor": "rgb(255, 255, 255)", "backgroundColor": "rgb(253, 123, 35)", "labelColor": "rgb(253, 123, 35)", "generic": { "primaryFields":[], "secondaryFields":[], "auxiliaryFields":[] } }

@alexandercerutti
Copy link
Owner

I kindly ask you to use triple ` here in GitHub to group your code together, just like I edited your's above.

Okay so you are adding things manually. Which could mean that the content you are sending to the function already contains the placeholder. Don't know how else I can help you with this.

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

Ok thank u, could please clarify best practice based on JS

@alexandercerutti
Copy link
Owner

I cannot think of a best practice right now.

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

Ok take your time

@alexandercerutti
Copy link
Owner

No I meant that I don't know what I can suggest you because I don't know what you are referring to.

However, let me know what are you discovery in Console.app

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

Ok you mean this logs :
[app<application.com.apple.Pass-Viewer.1152921500312124392.1152921500312124401(501)>:60704] Ignoring jetsam update because this process is not memory-managed [app<application.com.apple.Pass-Viewer.1152921500312124392.1152921500312124401(501)>:60704] Ignoring suspend because this process is not lifecycle managed [app<application.com.apple.Pass-Viewer.1152921500312124392.1152921500312124401(501)>:60704] Ignoring GPU update because this process is not GPU managed [app<application.com.apple.Pass-Viewer.1152921500312124392.1152921500312124401(501)>:60704] Ignoring memory limit update because this process is not memory-managed

@alexandercerutti
Copy link
Owner

alexandercerutti commented Jun 27, 2024

You understand what is Console.app, right?
The MacOS application

@AzPsu
Copy link
Author

AzPsu commented Jun 27, 2024

Ok change logs, please take look and take your time for understanding, my issue!

@alexandercerutti
Copy link
Owner

Almost the right logs, but these do not report anything about the PKPass. Did you try following the guide in the wiki?

@AzPsu
Copy link
Author

AzPsu commented Jun 30, 2024

Please take look for this :

Invalid data error reading pass pass.com.psu.ever/0000001. No entry in manifest for file model/mycard.pass/logo.png
An uncaught exception was raised
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
(
	0   CoreFoundation                      0x00000001871a32ec __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000186c8a788 objc_exception_throw + 60
	2   CoreFoundation                      0x00000001870ce934 -[__NSArrayM insertObject:atIndex:] + 1288
	3   Pass Viewer                         0x0000000100aa8c74 Pass Viewer + 19572
	4   AppKit                              0x000000018adcdedc -[NSApplication _doOpenFile:ok:tryTemp:] + 324
	5   AppKit                              0x000000018addfafc __88-[NSApplication(NSAppleEventHandling) _openURLs:requestedBySourceApp:completionHandler:]_block_invoke.41 + 292
	6   AppKit                              0x000000018addf89c withWindowOrderingObserverHeuristic + 544
	7   AppKit                              0x000000018addf3e0 -[NSApplication(NSAppleEventHandling) _openURLs:requestedBySourceApp:completionHandler:] + 1108
	8   AppKit                              0x000000018abed59c __69-[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:]_block_invoke + 564
	9   AppKit                              0x000000018abed2e4 -[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:] + 244
	10  AppKit                              0x000000018a9922c0 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 412
	11  Foundation                          0x0000000188237374 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 316
	12  Foundation                          0x0000000188237168 _NSAppleEventManagerGenericHandler + 80
	13  AE                                  0x000000018e14c9c4 _AppleEventsCheckInAppWithBlock + 13808
	14  AE                                  0x000000018e14c2ec _AppleEventsCheckInAppWithBlock + 12056
	15  AE                                  0x000000018e1458a8 aeProcessAppleEvent + 488
	16  HIToolbox                           0x00000001918e002c AEProcessAppleEvent + 68
	17  AppKit                              0x000000018a98c074 _DPSNextEvent + 1440
	18  AppKit                              0x000000018b181808 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
	19  AppKit                              0x000000018a97f09c -[NSApplication run] + 476
	20  AppKit                              0x000000018a9562e0 NSApplicationMain + 880
	21  dyld                                0x0000000186cc60e0 start + 2360
)

@alexandercerutti
Copy link
Owner

alexandercerutti commented Jun 30, 2024

Oh I think I can see the issue:

You wrote:

newPass.addBuffer("./model/mycard.pass/logo.png", buffer);

But you should have used only logo.png.

I think that a path in you pkpass is being created and Apple Wallet doesn't recognize it.

Change it and let me know.

@AzPsu
Copy link
Author

AzPsu commented Jul 2, 2024

Yes it's work thanks.

@AzPsu AzPsu closed this as completed Jul 2, 2024
@alexandercerutti
Copy link
Owner

Yay! If you could leave a 🌟 to the project, that would be awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants