Error 1: Cannot set headers after they are sent to the client

NoSuchKey