rmddx / shipstation-note-parser

unmerges notes
0 stars 1 forks source link

"Custom Field 1" is updating correctly, but not "Note from Buyer" #1

Open frostbeardstudio opened 5 months ago

frostbeardstudio commented 5 months ago

I've got everything mostly working, but only "Custom Field 1" is updating correctly. "Note from Buyer" still shows this type of tracking data from apps.

null<br/>internal-tracking-data: 123

Could you help me troubleshoot what's going on?

rmddx commented 5 months ago

Sure, can you post what's getting logged?

frostbeardstudio commented 5 months ago

Yep, here's a full log of a recent test.

{ "insertId": "65b046250003cbae550c9360", "httpRequest": { "requestMethod": "POST", "requestUrl": "https://us-central1-shipstation-notes-from-buyer.cloudfunctions.net/shipstation-note-parser", "requestSize": "1115", "status": 200, "responseSize": "736", "remoteIp": "34.200.1.155", "serverIp": "216.239.36.54", "latency": "4.084118843s", "protocol": "HTTP/1.1" }, "resource": { "type": "cloud_run_revision", "labels": { "configuration_name": "shipstation-note-parser", "project_id": "shipstation-notes-from-buyer", "service_name": "shipstation-note-parser", "revision_name": "shipstation-note-parser-00009-bas", "location": "us-central1" } }, "timestamp": "2024-01-23T23:05:05.155702Z", "severity": "INFO", "labels": { "goog-managed-by": "cloudfunctions", "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Frequests", "trace": "projects/shipstation-notes-from-buyer/traces/9cf1a260bf41c5e7bcb39c3049495a94", "receiveTimestamp": "2024-01-23T23:05:09.256242940Z", "spanId": "17534082903648329722", "traceSampled": true }

{ "insertId": "65b046210006b7c7496c3642", "jsonPayload": { "message": "starting", "cloud_function_name": "shipstation-note-parser" }, "resource": { "type": "cloud_run_revision", "labels": { "service_name": "shipstation-note-parser", "project_id": "shipstation-notes-from-buyer", "revision_name": "shipstation-note-parser-00009-bas", "configuration_name": "shipstation-note-parser", "location": "us-central1" } }, "timestamp": "2024-01-23T23:05:05.440263Z", "severity": "INFO", "labels": { "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c", "goog-managed-by": "cloudfunctions" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2024-01-23T23:05:05.449012108Z" }

{ "insertId": "65b046210006b7e2a8da89fb", "jsonPayload": { "cloud_function_name": "shipstation-note-parser", "request_body": { "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "resource_type": "ORDER_NOTIFY" }, "message": "parsing request" }, "resource": { "type": "cloud_run_revision", "labels": { "location": "us-central1", "service_name": "shipstation-note-parser", "project_id": "shipstation-notes-from-buyer", "configuration_name": "shipstation-note-parser", "revision_name": "shipstation-note-parser-00009-bas" } }, "timestamp": "2024-01-23T23:05:05.440290Z", "severity": "INFO", "labels": { "goog-managed-by": "cloudfunctions", "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2024-01-23T23:05:05.449012108Z" }

{ "insertId": "65b046210006b7f222f8733f", "jsonPayload": { "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "message": "checking resource", "cloud_function_name": "shipstation-note-parser", "request_body": { "resource_type": "ORDER_NOTIFY", "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548" } }, "resource": { "type": "cloud_run_revision", "labels": { "service_name": "shipstation-note-parser", "project_id": "shipstation-notes-from-buyer", "location": "us-central1", "revision_name": "shipstation-note-parser-00009-bas", "configuration_name": "shipstation-note-parser" } }, "timestamp": "2024-01-23T23:05:05.440306Z", "severity": "INFO", "labels": { "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c", "goog-managed-by": "cloudfunctions" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2024-01-23T23:05:05.449012108Z" }

{ "insertId": "65b046240003021ba7dfbb73", "jsonPayload": { "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "message": "processing 1 order(s)", "request_body": { "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "resource_type": "ORDER_NOTIFY" }, "order_count": 1, "cloud_function_name": "shipstation-note-parser" }, "resource": { "type": "cloud_run_revision", "labels": { "revision_name": "shipstation-note-parser-00009-bas", "configuration_name": "shipstation-note-parser", "service_name": "shipstation-note-parser", "location": "us-central1", "project_id": "shipstation-notes-from-buyer" } }, "timestamp": "2024-01-23T23:05:08.197147Z", "severity": "INFO", "labels": { "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c", "goog-managed-by": "cloudfunctions" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2024-01-23T23:05:08.440740378Z" }

{ "insertId": "65b046250003bfa5230ff964", "jsonPayload": { "cloud_function_name": "shipstation-note-parser", "request_body": { "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "resource_type": "ORDER_NOTIFY" }, "message": "updated order 792343565", "note_original": "null<br/>__comet_token: 22846667254212799016109701113414778408104063095781<br/>__comet_fingerprint: 26dde91540356061ac5460da6ba308d3", "order_count": 1, "note_parsed": "", "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548" }, "resource": { "type": "cloud_run_revision", "labels": { "service_name": "shipstation-note-parser", "project_id": "shipstation-notes-from-buyer", "configuration_name": "shipstation-note-parser", "revision_name": "shipstation-note-parser-00009-bas", "location": "us-central1" } }, "timestamp": "2024-01-23T23:05:09.245669Z", "severity": "INFO", "labels": { "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c", "goog-managed-by": "cloudfunctions" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2024-01-23T23:05:09.443073438Z" }

{ "insertId": "65b046250003bfbb282c2293", "jsonPayload": { "request_body": { "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "resource_type": "ORDER_NOTIFY" }, "message": "complete", "resource_url": "https://ssapi.shipstation.com/orders?importBatch=f34ec9df-4c5c-4d2f-92d8-ef8866fe3548", "cloud_function_name": "shipstation-note-parser", "order_count": 1 }, "resource": { "type": "cloud_run_revision", "labels": { "configuration_name": "shipstation-note-parser", "service_name": "shipstation-note-parser", "revision_name": "shipstation-note-parser-00009-bas", "location": "us-central1", "project_id": "shipstation-notes-from-buyer" } }, "timestamp": "2024-01-23T23:05:09.245691Z", "severity": "INFO", "labels": { "instanceId": "0087599d42048fcd22be8abb532aafc5fccc901088df479ed39da68bbc8bf03fe5adc266e7c9b2d8bde830e7adb8dcdb7ab3d3e616e56731ea2f301b0d4569bb6c", "goog-managed-by": "cloudfunctions" }, "logName": "projects/shipstation-notes-from-buyer/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2024-01-23T23:05:09.443073438Z" }

frostbeardstudio commented 5 months ago

I've been troubleshooting a bit. I've discovered that I was able to manually assign a value to $note on line 15 of NoteParser and have it sync to Shipstation. For whatever reason, the empty "" value doesn't want to work.

rmddx commented 5 months ago

oh, that rings a bell. I fixed that locally but never pushed it up. sorry! af732b91b87a3c4618617c3a64be29f1bb85690a adds a space to empty notes.

frostbeardstudio commented 5 months ago

Nice! It's working for us now.

Follow up question: do you know if there's a way to format the note so that it's totally blank? We use the "Note from Buyer" icon as a visual way to look for messages. Even the blank " " darkens the icon.

note_from_buyer

rmddx commented 5 months ago

The demo account I used to develop this has expired so testing isn't easy at the moment. Does passing a null value instead of a string work?

Or maybe try unsetting the customerNotes key around here

if (!trim($parser->getNote())) {
    unset($order['customerNotes']);
}
frostbeardstudio commented 5 months ago

Sadly that does not work. Passing a null or empty "" results in the customer note not changing.

It's weird, though. If I manually edit the note in Shipstation to any number of spaces, the icon returns to a light gray.

I'm happy to keep testing. If I get an update from the Shipstation API team I'll share it here.

rmddx commented 5 months ago

thanks. curious to know if you find a solution