The "humourless robot" is a fairly standard trope in modern-day science fiction. Many writers take the view that the sense of humour is a uniquely human property, and so make a point of writing robots, computers, and androids as utterly failing (often despite trying very hard) to understand jokes and sarcasm. Notable examples include Data from Star Trek and the titular cyborgs in the Terminator series of films. Many key scenes in these franchises, and even an entire TV episode, are dedicated to showing how humour is impenetrable to advanced artificial intelligence.
I'm interested in identifying the earliest published sci-fi story where the artificial recognition or production of humour is a major plot point. Note that this doesn't necessarily have to be an instance of the "humourless robot" trope—I would also accept a story hinging upon a computer or robot with a superhuman ability produce or understand jokes, in much the same way that Stanisław Lem's Elektrybałt has a superhuman ability to write poetry. But I do want to stress that I'm interested only in cases where the AI's skill (or lack thereof) at processing humour forms a crucial part of the story. Simply describing a world in which robots can or cannot understand humour is not enough; the way the characters develop or the way the narrative unfolds should depend in some crucial way on the (in)ability of an AI character to handle humour.