I think the `appId != undefined` is useless, you need this it a string and not empty.