   engineyard   : require './engineyard'
 
 
-checkCredential = (client, pubKey, callback)->
+reviveCredential = (client, pubKey, callback)->
+
+  [pubKey, callback] = [callback, pubKey]  unless callback?
+
+  if not pubKey?
+    return callback null
 
   JCredential = require './credential'
-  JCredential.fetchByPublicKey client, pubKey, (err, credential)->
-
-    if err or not credential?
-      console.warn err  if err
-      callback new KodingError "Credential failed.", "AccessDenied"
-    else
-      callback null, credential
+  JCredential.fetchByPublicKey client, pubKey, callback
 
 
 reviveClient = (client, callback, revive = yes)->



module.exports = {
  PROVIDERS, fetchStackTemplate, revive, reviveClient, checkCredential
}

      # This is Koding only which doesn't need a valid credential
      # since the user session is enough for koding provider for now.

      if shouldPassCredential and not credential?
        if provider isnt 'koding'
          return callback new KodingError \
            "Credential is required.", "MissingCredential"

      reviveCredential client, credential, (err, cred)=>

        if err then return callback err

        if shouldPassCredential and not cred?
          return callback new KodingError "Credential failed.", "AccessDenied"
        else
          options.credential = cred  if cred?

        fn.call this, client, options, callback

