title: Uncaught You must specify a key using Parse.initialize
body: <p>I've been using Parse for about three months but have started a new app. I am using Parse 1.4.2 js sdk.</p>
  
  <p>I have some code in a separate file which is making a request to the database. The file is included in the main.js file.</p>
  
  <p>When I try to deploy (using 1.4.2 sdk) I am getting the error:</p>
  
  <pre><code>Uploading source files
  Uploading recent changes to scripts...
  The following files will be uploaded:
  /Users/aaron/dev/Familiar/cloud/main.js
  /Users/aaron/dev/Familiar/cloud/user.js
  /Users/aaron/dev/Familiar/cloud/verification.js
  Finished uploading files
  Uncaught You must specify a key using Parse.initialize.
  </code></pre>
  
  <p>If I try to deploy using the latest sdk, I get the error:</p>
  
  <pre><code>Uploading source files
  Uploading recent changes to scripts...
  The following files will be uploaded:
  /Users/aaron/dev/Familiar/cloud/verification.js
  Finished uploading files
  TypeError: Object #&lt;Object&gt; has no method 'request'
      at Object.ajaxMod [as ajax] (&lt;anonymous&gt;:925:19)
      at e.&lt;anonymous&gt; (Parse.js:13:25717)
      at e.s (Parse.js:12:26759)
      at Parse.js:12:27145
      at i (Parse.js:12:27100)
      at e.n.value (Parse.js:12:27130)
      at Object.y.request (Parse.js:13:25644)
      at Object.u.default.setQueryController.find (Parse.js:13:6132)
      at e.a.value (Parse.js:13:76)
      at e.&lt;anonymous&gt; (verification.js:18:38)
  </code></pre>
  
  <p>If I comment out all of <code>verification.js</code> it will upload, but with it uncommented I get the error. My other working app never calls <code>Parse.initialize</code>. Why is it asking for it now?</p>
  
  <p>Directory structure:</p>
  
  <pre><code>├── cloud
  │   ├── comment.js
  │   ├── lib
  │   │   ├── config.js
  │   │   ├── helpers.js
  │   │   └── md5.js
  │   ├── main.js
  │   ├── user.js
  │   └── verification.js
  ├── config
  │   └── global.json
  └── public
      └── index.html
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>require("cloud/user.js");
  require("cloud/comment.js");
  require("cloud/verification.js");
  </code></pre>
  
  <p><strong>verification.js</strong></p>
  
  <pre><code>var conf = require("cloud/lib/config.js").conf;
  var helpers = require("cloud/lib/helpers.js");
  
  function createSmsVerification(user) {
      return getUserSmsVerification(user)
          .then(function (verification) {
              var verificationQuery = new Parse.Query("Verification");
              return verificationQuery.first(); &lt;-- this is the line causing the error
          })
          .then(function (verification) {
              return verification;
          }, function (error) {
              return Parse.Promise.error("createSmsVerification - " + error.message);
          });
  }
  exports.createSmsVerification = createSmsVerification();
  
  function getUserSmsVerification(user) {
      return Parse.Promise.as();
  }
  </code></pre>
  
  <p><strong>user.js</strong></p>
  
  <pre><code>var helpers         = require("cloud/lib/helpers.js"),
      conf            = require("cloud/lib/config.js").conf,
      sms             = require("cloud/sms.js"),
      verification    = require("cloud/verification.js");
  
  
  Parse.Cloud.define("register", function(request, response){
      Parse.Cloud.useMasterKey();
      var phoneNumber = request.params.phoneNumber;
      var user;
      var userQuery = new Parse.Query(Parse.User);
      userQuery.equalTo("username", phoneNumber);
  
      return userQuery
          .first(function(userResult){
              if(!helpers.isDefined(userResult)){
                  userResult = createNewUser(phoneNumber);
              }else{
                  userResult.set("smsVerified", false);
              }
              return userResult.save();
          })
          .then(function(userResult){
              user = userResult;
              return verification.createSmsVerification(user);
          })
          .then(function(){
              response.success();
          }, function (error){
              console.error("register - " + error.message);
              response.error(error.message);
          });
  });
  
  function createNewUser(phoneNumber){
      var newUser = new Parse.User();
      newUser.set("username", helpers.phoneToUsername(phoneNumber));
      newUser.set("password", helpers.generatePassword(phoneNumber));
      newUser.set("smsVerified", false);
      return newUser;
  }
  </code></pre>