With a bit of assistance, DSolve
can obtain the desired solution. ode
has a first integral, which is obtained by
Integrate[Subtract @@ ode, x, GeneratedParameters -> C] == 0
(* -E^y[x] + C[1] + Derivative[1][y][x] == 0 *)
Applying the initial conditions then yields
Solve[% /. x -> 3 /. Rule @@@ ic, C[1]] // Flatten
(* {C[1] -> 0} *)
DSolve
now obtains the desired solution
DSolve[{%% /. %, ic}, y[x], x] // Flatten
(* {y[x] -> -Log[4 - x]} *)
Addendum
To answer why DSolve
fails in the question, consider
s = DSolveValue[{ode, First@ic}, y[x], x, , Assumptions -> C[1] ∈ Reals]
(* -Log[-(1/C[1]) + (E^(3 C[1] - x C[1]) (1 + C[1]))/C[1]] *)
Applying the second boundary condition then yields
Solve[1 == D[s, x] /. x -> 3, C[1]] // Flatten
{C[1] -> 0}
Of course, inserting this value of C[1]
into s
fails.
Power::infy: Infinite expression 1/0 encountered.
On the other hand, as suggested by Mariusz Iwaniuk in a comment,
Limit[s, %]
(* -Log[4 - x] *)
does work. Apparently, DSolve
does not try this.