Oven lights, but goes out in seconds

Our New (1.5 year old) whirlpool range has been intermittenly having problems lighting the oven. It sparks, and sometimes lights, but goes out after a couple of seconds. If you tried several times, it would usually work OK the rest of the day. Now, it won’t ever stay on, about 3 seconds of burning, and then it shuts off. It will retry in a short while. Do I have a problem with the burner and ignighter, or with the gas valve that won’t stay on?

thanks

guess I’ll try the burner/igniter and see if it works. /If it was the gas solonoid, it would not light at all By my reconing.

well, that did not change a thing. The controls still does not know the burner is burning and shuts off the gas. What is next, the spark generator?