Improve "Amazon Items could not be updated" message from cron
asb - September 8, 2009 - 22:38
| Project: | Amazon Module |
| Version: | 6.x-1.0-beta10 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed |
Description
Hi,
I'm getting the following message in my watchdog log after each Cron run:
Amazon items could not be updated.
No reason is given. What is going wrong?
Thanks & greetings, -asb

#1
Similar and/or possibly related issue: #554352: Get this on every Cron run: Warning: Invalid argument supplied for foreach() .
#2
One probable reason: An ASIN that you have is no longer available on Amazon.com. You can check this by searching on Amazon for the ASIN.
Please confirm whether this is the case.
#3
> One probable reason: An ASIN that you have is no longer available on Amazon.com.
> You can check this by searching on Amazon for the ASIN.
> Please confirm whether this is the case.
Searching for which ASIN? The message simply says:
Amazon items could not be updated.No ASIN is referenced. Also, no stats are given (like "Could noch refresh Amazon data for 2 of 523 items"), so I don't know if this applies to one, to more than one or all items.At ./admin/settings/amazon there is no "management interface" that lists the refreshing status of the stored items so I simply don't know how I could find out which status gives Amazon back. Am I missing something here?
Thanks & greetings, -asb
#4
Are you comfortable hacking the code on a copy of your site?
In that case, you can update the message to give more information and we can solve this.
Otherwise, I'll change the message for the next release and we'll see what we learn.
I would also accept an export of your database. Please put it somewhere I can get it and give me a URL, by email if you prefer.
#5
Committed a far better error message, with full details of the failure from Amazon, http://drupal.org/cvs?commit=270970
One issue: The lookups are batched together in sets of up to 10, and any one can cause the set to fail. There's no trivial way around this (besides parsing AWS's error message, which might change over time). But at least you get full disclosure of what is causing the failure.
If this doesn't resolve your issue, please reopen it.
#6
In the hook_update_N I tried fixing the ASINs by deleting them all, and this works only if all nodes are viewed before using them. So it breaks views, for example. So I backed that out.
Still need a good way in hook_update_N to clean up invalid items, so this is a reminder to sort that out.
#7
Massive improvements - added a field to amazon_item that shows it's invalid, and this is now available to views.
#8
Hi,
after upgrading to 6.x-1.0-beta9 I'm getting:
Error retrieving Amazon item AWS.MissingParameters, message: Your request is missing required parameters. Required parameters include ItemId..This error message is clearly improved, but still doesn't point to the missing required parameters or even the item in question ;)
Greetings, -asb
#9
Hmm, what should we do with this issue - probably re-open it?
#10
This sounds like a pretty major problem, but I'm not having it.
Please let me know when and how you go this error. I'll probably have to release a beta10 later today, so if you can help me understand how you get the error we can get it fixed.
Thanks for checking it out! Did you see the new docs?
I'm on IRC (rfay) or you can catch me by email through the contact page too.
-Randy
#11
Also, please make sure you ran update.php.
#12
> Please let me know when and how you go this error. I'll probably have to release a beta10 later today,
> so if you can help me understand how you get the error we can get it fixed.
"When": When cron is running, I think.
To which item this message points: That was the initial issue - I'd like to know what (item, NID...) I should look for.
How I updated: drush announced a new release; I did the usual
drush refresh ; drush update ; drush updatedb. And yes, I ran an update.php manually, also.I don't think that this error is a major new problem of 'Amazon' module; it's most probably simply stale data the module can't handle (yet).
What I would need would be a pointer to the NID that contains the item in question - then I can look it up at Amazon. Maybe it's simply a product that vanished from their catalogue. Then we can think about how to handle such inconsistent data.
Thanks & greetings, -asb
#13
Thanks, asb. Please attach a dump of your amazon_item table. Much appreciated.
mysqldump [-uusername -ppassword -hhost] <databasename> amazon_item >dumpfile.txt-Randy
#14
#15
Thanks, asb.
You have an empty row in your asin table. Please delete it:
delete from amazon_item where asin='';I don't know how it got there or how much pain it may have caused you over time.
I will take a look at preventing a lookup when the ASIN is empty.
-Randy
#16
I just added code that prevents trying to process an empty ASIN.
Thanks so much for letting me know about your issues.
Your contributions and feedback about the new doc page are much requested. It's always nice to know there's somebody out there :-)
I'll probably do a new release in a few hours to get this little change in, so if you have any feedback about this release before then, I will sure appreciate it.
Marking this fixed, but I know that you know how to set it right if you need to.
-Randy
#17
And while we're on the subject: The new field 'invalid_asin' was added in response to this issue and issues like it. An invalid asin is now labeled as such in the db. And this is available from views. You can create a simple Amazon Item type view (no relationship required even!) and see what items are invalid. You don't even have to look at the fancy new error messages.
However, you'll probably want to set up a view with a relationship to the Amazon Items, so you can see what *node* is involved, and perhaps delete it. You can filter on invalid_asin, and you could even use something like Views Bulk Operations to delete those items. If that's what you want to do. Since having the items in there no longer interrupts the flow of updating, you can leave them there and nothing happens but you get a warning in the log.
#18
You're referring to this one:
mysql> select timestamp from amazon_item where asin='';+------------+
| timestamp |
+------------+
| 1243346283 |
+------------+
1 row in set (0.00 sec)
WTF... all other fields have a NULL value?!
So #17 sounds like a huge improvement!
Thanks a lot!
-asb
#19
Please let me know if deleting this row gets you going.
#20
Hi,
Is this the right place to put this message?
We have the latest Amazon module 6.1.0-beta10. Just wanted you to know that I also was having that I also had that "Amazon Items could not be updated" message after a cron run. I did a Google search and found this issue message list. I saw your message about the deleting the empty row from the datebase. I went into the phpMyAdmin and found Table: amazon_item. I "browsed" inside that table and saw an empty row and deleted it. Then reran cron and the log entry was:
So, from that message, I'm assuming the deleting the blank row solved the problem. Thanks!!!
Note: when I reran cron and got this message: (I wonder if this means anything)
When the above notice says "Attempted to fetch information about all available new releases and updates", does that mean that there was a problem, or is that just the normal message? Also, below that it says, "Severity notice", does the "notice" mean anything bad?
I imagine that everything is OK, but having the "Message" line say "Attempted to..." gave me some concern.
Thanks for the message about deleting that blank line in the amazon_item table. That helped me and much appreciated.
Best Wishes,
Stephen
#21
Hi Stephen: The "Attempted to fetch information about all available new releases and updates" message above is from the Update Status module and has nothing to do with Amazon.
Glad it's working for you.
#22
Automatically closed -- issue fixed for 2 weeks with no activity.