alexandercerutti / passkit-generator

The easiest way to generate custom Apple Wallet passes in Node.js
MIT License
897 stars 109 forks source link

Not Working PassKit After Generated #207

Closed AzPsu closed 4 months ago

AzPsu commented 5 months ago

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, test@test.com, 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, Test@test.com, null, null, null, null) flutter: INFO🔷 | MyAPP: Add pass result: false

alexandercerutti commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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: "app-engine-appserver@prod.google.com" }

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: "app-engine-appserver@prod.google.com" }`

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

AzPsu commented 5 months ago

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 commented 5 months ago

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

I cannot link it to you right now, sorry

alexandercerutti commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

alexandercerutti commented 5 months ago

I cannot think of a best practice right now.

AzPsu commented 5 months ago

Ok take your time

alexandercerutti commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

AzPsu commented 5 months ago

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

alexandercerutti commented 5 months ago

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

AzPsu commented 5 months ago

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 commented 5 months ago

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 commented 4 months ago

Yes it's work thanks.

alexandercerutti commented 4 months ago

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