klaviyo / magento2-klaviyo

38 stars 51 forks source link

klaviyo_events_topic cron error #193

Closed JamesFX2 closed 1 year ago

JamesFX2 commented 2 years ago

Notice: Undefined index: Categories in app/code/Klaviyo/Reclaim/Cron/EventsTopic.php on line 156

Assuming it's because the payload field is truncated. I'm sure you're just going to change it to mediumtext but please consider a more optimal storage strategy, i.e. pulling the details from the product repository (so they're cached) and instead of loading the same category over and over, try caching any pulled names cos... yeah, that's gonna slow your process. You might also want to use a try/catch.

Here's the payload field from the top entry.


{"$value":0,"ItemNames":["Paracetamol - 32 x 500mg Caplets (Brand May Vary)","Co-Codamol - 32 x 8\/500mg Tablets (Brand May Vary)","Cuprofen Maximum Strength 400mg - 96 Tablets","Anthisan Cream For Insect Bites & Stings \u2013 25g","Numark Family Strength Insect Repellent Spray - 100ml","Germolene Antiseptic Cream - 30g","EMLA Cream 5% - 5g","Numark Anti-Diarrhoea Capsules (Loperamide 2mg) \u2013 12 Capsules","Buscopan IBS Relief \u2013 40 Tablets","Dulcolax Laxative 5mg - 20 Tablets","Nelsons Arnicare Arnica Cream - 50g","Phizz Multivitamin & Hydration Effervescent Apple and Blackcurrant Flavour - 10 Tablets","Riemann P20 SPF 50+ - 100ml Spray","Sunsense SPF50+ Lip Balm","Avoca The Complete Wart & Verruca 95% Silver Nitrate Treatment","Excilor Fungal Nail Infection Treatment Pen","Sunsense Ultra SPF 50+ Roll On (Free Gift)"],"Items":[{"Categories":["3","26","127","557","708","1113","1437","1590","1944","2151","2013","2296","2307","1815","2420"],"ImageUrlKey":"\/p\/a\/paractamol_easy_to_swallow_500mg_32_1200px.jpg","ProductId":13658,"Price":0.99,"Title":"Paracetamol - 32 x 500mg Caplets (Brand May Vary)","Description":"What are Paracetamol Caplets?\r\nParacetamol Caplets are quick and easy to take painkillers that can be used to relieve a number of different aches and pains. Ideal for those looking to ease everyday ailments such as headaches, period pain, and toothache.\r\n \r\nWhat kinds of pain can this product be used for?\r\nParacetamol Caplets can be used to ease many kinds of pain and other symptoms. Some of the most popular reasons to use this product include:\r\n\r\nHeadaches\r\nMigraines\r\nNeuralgia\r\nToothache\r\nSore throat\r\nPeriod pain\r\nFlu\r\nFever\r\nAches and pains\r\nMuscle pain\r\nBack ache\r\nRheumatic aches and pains\r\n\r\n \r\nHow will this product help to ease my pain?\r\nParacetamol Caplets contain 500mg of the active ingredient paracetamol, which is a popular painkiller for everyday ailments. It helps to relieve pain but can also be used to ease fever and lower high temperatures.\r\n \r\nHow to take Paracetamol Caplets\r\nFor adults and children over the age of 16, take 1 – 2 Paracetamol Caplets every 4 – 6 hours as needed. For children between the ages of 10 – 15, take one caplet every 4 – 6 hours as needed. Do not take more than 4 doses in any 24-hour period.\r\n \r\nWhy do I need to answer questions to buy this product?\r\nYou do not need a prescription for Paracetamol Caplets, however you will be asked to complete a short medical questionnaire by your Chemist-4-U pharmacist before we can take your order. This includes some simple questions that all pharmacies legally are required to ask before supplying this kind of product. This helps our pharmacy team to be sure that this product is the best choice for you.\r\n \r\nWhen should Paracetamol Caplets not be used?\r\nParacetamol Caplets are not suitable for use by children under the age of 10. Do not take this product if you are allergic to paracetamol or any of the listed ingredients. Do not take this product if you are taking any other medicines containing paracetamol. Speak to your doctor before using Paracetamol Caplets if you:\r\n\r\nSuffer from liver or kidney problems\r\nHave heart disease\r\nSuffer from G6PD deficiency\r\nSuffer from alcohol dependency\r\nSuffer from mild arthritis and need to take painkillers every day\r\nAre pregnant or breastfeeding\r\n\r\nParacetamol Caplets should not be taken at the same time as some other medicines, as they may interact. For a list of medicines you should not take with this product, please read the patient information leaflet.\r\n \r\nDoes this product have any side effects?\r\nLike all medicines, Paracetamol Caplets can have side effects, although not everyone will get them. These side effects include:\r\n\r\nSkin rashes and itching\r\nDifficulty breathing\r\nSwollen face\r\nUnusual bruising or bleeding, throat and mouth ulcers or bleeding gums accompanied by tiredness and flu like symptoms\r\nBlood problems including anaemia\r\nPain in the lower back and groin\r\nChanges in your urine\r\nPancreatitis\r\nHepatitis\r\nVery rare cases of serious skin reactions\r\n\r\nIf you experience these or any other side effects while using this product, stop use and speak to your doctor or Chemist 4 U pharmacist right away.\r\n \r\nImportant Information\r\nThis product is a medicine; make sure to speak to your doctor or Chemist-4-U pharmacist before taking this product if you have an underlying medical problem or are taking any other medicine or complementary therapy. If your symptoms get worse or continue after taking this product, contact us or your doctor. For medical services in your area, please refer to https:\/\/www.nhs.uk\r\nIf you are pregnant, trying to become pregnant, or breastfeeding, speak to your doctor or our pharmacist before taking this product. If you suffer from any allergies, ask your doctor or our pharmacist if this medicine is right for you.\r\nStore all medicines out of sight and reach of children.\r\nPlease read the included leaflet carefully before using this product.\r\nPlease contact your GP if appropriate regarding this product.","Url":"https:\/\/www.chemist-4-u.com\/paracetamol-500mg-32-caplets","Quantity":2},{"Categories":["3","26","637","708","1110","1514","1339","2151","2307","1815","2613"],"ImageUrlKey":"\/3\/4\/3467040-vg.jpg","ProductId":10549,"Price":3.99,"Title":"Co-Codamol - 32 x 8\/500mg Tablets (Brand May Vary)","Description":"What are Co-Codamol Tablets?\r\nCo-Codamol Tablets are a painkiller which combines 2 active ingredients to help to relieve your pain, paracetamol and codeine. This is the perfect temporary pain relief for those who find that their pain is not eased by painkillers such as ibuprofen or paracetamol alone. If you’re suffering from moderate pain such as a migraine, toothache, or rheumatic pain, co-codamol can help to ease your pain until they’ve passed.\r\n \r\nWhat kinds of pain can these tablets help to relieve\r\nCo-Codamol Tablets can be used for many different kinds of moderate pain that can’t be relieved with painkillers like paracetamol alone. Some of the most common uses for this product include:\r\n\r\nHeadaches\r\nMigraine\r\nToothache\r\nNeuralgia\r\nPeriod pain\r\nRheumatic pains\r\n\r\n \r\nHow will co-codamol tablets help to ease my pain?\r\nCo-Codamol Tablets contain two active ingredients which are both painkillers; 500mg of paracetamol and 8mg of codeine. Paracetamol is a popular everyday painkiller that can reduce high temperatures and fever, which is an effective way to treat cold and flu symptoms. Codeine is a kind of painkiller called opioid analgesics and can be used to ease moderate pains when paracetamol isn’t enough by itself.\r\n \r\nCan I take this product if I’m pregnant or breastfeeding?\r\nSpeak to your doctor or pharmacist before taking this product if you’re pregnant or planning to become pregnant. Medical professionals usually won’t recommend medicines which contain codeine at this time. Do not take co-codamol if you’re breastfeeding, the codeine in this medication can metabolise into morphine and pass into your breast milk.\r\n \r\nCan I drive after taking co-codamol?\r\nCo-codamol can affect your ability to drive, as it can make you feel dizzy or sleepy. Do not attempt to drive or use tools or machinery until you are sure that you are not affected in this way\r\n \r\nCan I take these tablets if I’m taking other medication?\r\nIf you’re taking any other medication, including those you bought without a prescription, you should speak to your doctor or pharmacist before taking co-codamol tablets. You should not take these tablets if you’re taking any other medications which contain paracetamol. Tell your doctor or pharmacist if you’re already taking:\r\n\r\nBenzodiazepines, which are used to treat anxiety\r\nBlood thinners, or anticoagulants, such as warfarin\r\nMetoclopramide or domperidone, which are used to treat nausea and vomiting\r\n\r\n \r\nWill I get addicted to these tablets?\r\nCo-codamol can be addictive in some circumstances, but if you follow the instructions recommended by the manufacturer or your doctor or pharmacist this is unlikely to happen. If you’re concerned about becoming dependent on this medication or need to take this product for longer periods, ask your doctor or pharmacist for advice.\r\n \r\nHow to take these tablets\r\nSwallow co-codamol tablets whole with a drink of water. Do not take for more than 3 days unless recommended to do so by your doctor.\r\n\r\nAdults: Take 2 tablets every 4 – 6 hours, as needed. Do not take more than 8 tablets in any 24 hours\r\nChildren aged 16 – 18: Take 1 – 2 tablet every 6 hours, as needed. Do not take more than 8 tablets in any 24 hours\r\nChildren aged 12 – 15: Take 1 tablet every 6 hours, as needed. Do not take more than 4 tablets in any 24 hours\r\n\r\n \r\nWhy do I need to answer questions to buy this product?\r\nYou do not need a prescription for Co-codamol Tablets, however, you will be asked to complete a short medical questionnaire by your Chemist-4-U pharmacist before we can take your order. This includes some simple questions that all pharmacies legally are required to ask before supplying this kind of product. This helps our pharmacy team to be sure that this product is the best choice for you.\r\n \r\nWhen should Co-Codamol Tablets not be used?\r\nCo-Codamol Tablets should not be taken by children under the age of 12. Do not take this product if you are allergic to paracetamol, codeine, or any of the other listed ingredients. Do not take Co-Codamol Tablets if you:\r\n\r\nAre under the age of 18 and have had your tonsils or adenoids removed due to obstructive sleep apnoea syndrome\r\nYou know that you metabolise codeine into morphine very rapidly\r\nYou are breastfeeding or planning to breastfeed\r\n\r\nSpeak to your doctor or pharmacist before taking this product if you:\r\n\r\nHave severe kidney or liver problems\r\nAre taking a benzodiazepine\r\n\r\n \r\nDoes co-codamol have any side effects?\r\nLike all medications, Co-Codamol Tablets can have side effects, although not everyone will get them. If you experience any of the following side effects, stop use and seek immediate medical assistance:\r\n\r\nSymptoms of a severe allergic reaction, such as swelling of the hands, feet, ankles, face, lips, or throat, difficulty swallowing or breathing, hives or nettle rash\r\nSerious skin reactions, very rare cases have been reported\r\nSevere stomach pain, which may reach through to your back. This could be a sign of inflammation of the pancreas and is also very rare\r\n\r\nOther side effects you may experience include:\r\n\r\nConstipation, feeling sick, being sick\r\nDizziness, light-headedness, drowsiness, confusion\r\nDifficulty passing water\r\nGetting more infections or bruising easily than usual\r\nBecoming dependant on codeine\r\n\r\nIf you experience these or any other side effects while taking Co-Codamol Tablets, stop use and speak to your doctor or pharmacist. For more information about reporting the side effects of this medication, please see the MHRA’s Yellow Card Scheme.\r\n \r\nHow to store this product\r\nStore in a cool, dry place which is below 25 degrees C. Do not use this product if the expiry date printed on the original packaging has passed. Keep out of sight and reach of children.\r\n \r\nImportant Information\r\nThis product is a medicine; make sure to speak to your doctor or Chemist 4 U pharmacist before taking this product if you have an underlying medical problem or are taking any other medicine or complementary therapy. If your symptoms get worse or continue after taking this product, contact us or your doctor. For medical services in your area, please refer to https:\/\/www.nhs.uk\r\nIf you are pregnant, trying to become pregnant, or breastfeeding, speak to your doctor or our pharmacist before taking this product. If you suffer from any allergies, ask your doctor or our pharmacist if this medicine is right for you.\r\nStore all medicines out of sight and reach of children.\r\nPlease read the included leaflet carefully before using this product.\r\nPlease contact your GP if appropriate regarding this product.\r\n \r\nHelpful Advice on Medication Restrictions & Addiction\r\nFor further information on our medication restrictions policy, please click here\r\nIf you are concerned about addiction of 'over the counter' medication we urge you to visit the below links for professional help and advice\r\n\r\nNHS Help & Advice on Drug Addiction\r\nTalk To Frank - Codeine Addiction Help\r\n","Url":"https:\/\/www.chemist-4-u.com\/co-codamol-tablets-500mg-32-tablets","Quantity":1},{"Categories":["3","26","147","148","1106","1341","1392","1395","1493","1514","1517","1540","1545","2151","2216","2307","2409","2412","2418","1944"],"ImageUrlKey":"\/c\/u\/cuprofen-maximum-strength-tablets-96s-5000158105270.jpg","ProductId":4499,"Price":9.29,"Title":"Cuprofen Maximum Strength 400mg - 96 Tablets","Description":"What are Cuprofen Maximum Strength tablets?\r\nCuprofen Maximum Strength tablets are a pain relief medication that can also help to reduce swelling and high temperatures. Each tablet contains 400mg of the active ingredient, so you’ll only need to take one tablet at a time to get the most of this medication, perfect for those who don’t like swallowing tablets. If you’re suffering from pain, inflammation, or symptoms of cold and flu, Cuprofen tablets could be the perfect remedy for you.\r\n\r\nWhat types of aches and pains can I use this product for?\r\nCuprofen 400mg tablets can be used to ease lots of different aches and pains, and can also be used to reduce inflammation and high temperatures. Some of the most popular reasons why people take this product include:\r\n\r\n\r\nRheumatic pain\r\n\r\n\r\nMuscular pain\r\n\r\n\r\nDental pain\r\n\r\n\r\nPeriod pain\r\n\r\n\r\nBackache\r\n\r\n\r\nNeuralgia\r\n\r\n\r\nMigraines\r\n\r\n\r\nHeadaches\r\n\r\n\r\nSymptoms of cold and flu\r\n\r\n\r\nHigh temperature or fever\r\n\r\n\r\n\r\nHow will the ibuprofen in Cuprofen 400mg tablets help to ease my pain?\r\nEach Cuprofen tablet contains 400mg of a painkiller called ibuprofen. Ibuprofen is a type of medication called a Non-Steroidal Anti-Inflammatory Drug (NSAID), which means it works by changing how your body responds to pain. This helps to relieve your pain as well as reducing inflammation or swelling and bringing down fevers or high temperatures.\r\n\r\nCan I use this product if I’m taking other medication?\r\nIf you’re taking any other medication, including those you obtained without a prescription, you should speak to your doctor or pharmacist before taking this product. This especially applies if you are already taking:\r\n\r\n\r\nAnticoagulants, which are also known as blood thinners, e.g. warfarin, aspirin, ticlopidine\r\n\r\n\r\nMedications to reduce high blood pressure, e.g. ACE-inhibitors such as captopril, beta-blockers such as atenolol medicines, angiotensin-II receptor antagonists such as losartan\r\n\r\n\r\nCorticosteroids, e.g. prednisolone\r\n\r\n\r\nSSRIs (selective serotonin reuptake inhibitors)\r\n\r\n\r\nCardiac glycosides, e.g. digoxin\r\n\r\n\r\nLithium\r\n\r\n\r\nMethotrexate\r\n\r\n\r\nCiclosporin\r\n\r\n\r\nMifepristone\r\n\r\n\r\nTacrolimus\r\n\r\n\r\nZidovudine\r\n\r\n\r\nQuinolone antibiotics, e.g. norfloxacin\r\n\r\n\r\n\r\nCan I take ibuprofen if I’m already taking other painkillers?\r\nDo not take this medication if you are already taking any other NSAID painkillers, including aspirin, naproxen, and ibuprofen. As these are the same types of medication, they should not be taken together as this can cause unwanted effects. However, you can take Cuprofen at the same time as paracetamol, another popular pain relief, as they are different types of pain killer and do not interact. However, we recommend that you speak to your doctor or pharmacist before taking any two medications at the same time, just to be sure the combination is safe for you.\r\n\r\nCan I take this product if I’m pregnant or breastfeeding?\r\nYou should speak to your doctor or pharmacist before taking Cuprofen tablets if you are within the first 6 months of pregnancy or are breastfeeding. You should not take this product if you are in the last 3 months of pregnancy. If you’re suffering from pain during this time, you should ask your doctor, pharmacist, or health visitor for advice.\r\n\r\nHow to take these tablets\r\nSwallow 

Hah, had to double truncate it - "There was an error creating your Issue: body is too long (maximum is 65536 characters)."

cykolln commented 2 years ago

Hi @JamesFX2 - thank you for raising this issue. In May we released an update to our extension (4.0.4) which removes Product descriptions from the Added to Cart payload - this descriptions were often too large. I noticed in the payload you posted the description is present, have you updated to the latest version of the extension? We are currently looking into updating the field type as you mentioned as well as looking into how we can optimize our added to cart implementation.

cykolln commented 1 year ago

We've added handling for this in the latest release 4.0.7, see #215 . This includes adding in try catch blocks like you suggested so any exceptions due to existing truncated payloads in the DB don't prevent other rows from syncing. This is a first round of future added to cart improvements we plan to make - thank you for your continued feedback as we work to make our extension better!