null response to queries

Ok, I'll DM you, I don't know my account ID
2 Replies
elithrar
elithrar15mo ago
Thanks. I only see one error on our side for this. Note that we return null if .first() finds no results. Are you sure that amazonAsin is non-null/correctly formatted/actually present?
Elie Zedeck R.
Elie Zedeck R.15mo ago
@elithrar thanks for looking into the issue. Indeed, I am certain that it is not null and formatted correctly. The thing is, in the browser, there is for example a URL like https://book-profits-backend.elie-zedeck.workers.dev/api/1.0/products/is-associated-with-difficult-publisher/1413327621 that returns 404, because it did not find the product. However, when you visit it manually, it actually returns a result and is not 404 (you can actually test it yourself). That same URL sometimes returns 404, sometimes 200 even though the product and the URL is exactly the same, not changing. In fact, I see the 404 error in the browser's console, then I simply copy the link, open the same link in another Tab, and it returns the correct result. And it does this also locally when running with wrangler. I did try to run the query repetitively/consecutively and it never returns 404. Only when other queries are also run against the DB/Workers that it starts to randomly unable to find the existing product. I'm not sure what changed, but I don't seem to notice the null values anymore. Thanks for your fix!