title: Express JS: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type number
body: <p>I am going through this TUT to make a private app in shopify <a href="https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react/embed-your-app-in-shopify" rel="nofollow noreferrer">build-a-shopify-app-with-node-and-react</a></p>
  
  <p>The TUT uses <a href="https://expressjs.com/" rel="nofollow noreferrer">koa</a> but I am using <a href="https://koajs.com/" rel="nofollow noreferrer">express</a>. Partly because I know express and wanted to see if I could abstract what was going on and apply it in a different context.</p>
  
  <p>When I get to <a href="http://TypeError%20[ERR_INVALID_ARG_TYPE]:%20The%20%22url%22%20argument%20must%20be%20of%20type%20string.%20Received%20type%20number%20%20%20%20%20at%20Url.parse%20(url.js:154:11)%20%20%20%20%20at%20urlParse%20(url.js:148:13)%20%20%20%20%20at%20Object.urlResolve%20[as%20resolve]%20(url.js:659:10)%20%20%20%20%20at%20/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express-shopify-auth/index.js:190:19%20%20%20%20%20at%20Function.shop%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/server/server.js:28:14)%20%20%20%20%20at%20middleware%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express-shopify-auth/index.js:168:25)%20%20%20%20%20at%20Layer.handle%20[as%20handle_request]%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/layer.js:95:5)%20%20%20%20%20at%20trim_prefix%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:317:13)%20%20%20%20%20at%20/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:284:7%20%20%20%20%20at%20Function.process_params%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:335:12)%20%20%20%20%20at%20next%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:275:10)%20%20%20%20%20at%20session%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express-session/index.js:468:7)%20%20%20%20%20at%20Layer.handle%20[as%20handle_request]%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/layer.js:95:5)%20%20%20%20%20at%20trim_prefix%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:317:13)%20%20%20%20%20at%20/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:284:7%20%20%20%20%20at%20Function.process_params%20(/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:335:12)" rel="nofollow noreferrer">Authenticate and test your app</a> they want one to do this:</p>
  
  <blockquote>
    <p>Add the HTTPS version of your ngrok forwarding URL and your store’s
    URL to the following placeholder and load it in a browser:</p>
    
    <p>Tip
    </p>
  </blockquote>
  
  <p>Which results in my error:</p>
  
  <pre><code>TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type number
      at Url.parse (url.js:154:11)
      at urlParse (url.js:148:13)
      at Object.urlResolve [as resolve] (url.js:659:10)
      at /Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express-shopify-auth/index.js:190:19
      at Function.shop (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/server/server.js:28:14)
      at middleware (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express-shopify-auth/index.js:168:25)
      at Layer.handle [as handle_request] (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/layer.js:95:5)
      at trim_prefix (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:317:13)
      at /Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:284:7
      at Function.process_params (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:335:12)
      at next (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:275:10)
      at session (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express-session/index.js:468:7)
      at Layer.handle [as handle_request] (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/layer.js:95:5)
      at trim_prefix (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:317:13)
      at /Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:284:7
      at Function.process_params (/Users/antoniopavicevac-ortiz/Sites/scheduled-promo-bar/node_modules/express/lib/router/index.js:335:12)
  </code></pre>
  
  <p>This is my server.js:</p>
  
  <pre><code>/* eslint-disable vars-on-top */
  require('isomorphic-fetch');
  var express = require('express');
  var next = require('next');
  var ShopifyAuth = require('express-shopify-auth');
  var dotenv = require('dotenv');
  var session = require('express-session');
  
  dotenv.config();
  
  const port = parseInt(process.env.PORT, 10) || 3000;
  var dev = process.env.NODE_ENV !== 'production';
  var app = next({ dev });
  
  var { SHOPIFY_API_SECRET_KEY, SHOPIFY_API_KEY } = process.env;
  
  app.prepare().then(() =&gt; {
    var auth = ShopifyAuth.create({
      appKey: SHOPIFY_API_KEY,
      appSecret: SHOPIFY_API_SECRET_KEY,
      baseUrl: port,
      authPath: '/auth',
      authCallbackPath: '/auth/callback',
      authSuccessUrl: '/success',
      authFailUrl: '/fail',
      scope: ['read_products'],
      shop(req, done) {
        return done(null, req.query.shop);
      },
      onAuth(req, res, shop, accessToken, done) {
        // save auth info to session
        req.session.shopify = { shop, accessToken };
        return done();
      },
    });
  
    var server = express();
  
    server.use(
      session({
        secret: SHOPIFY_API_SECRET_KEY,
        resave: false,
        saveUninitialized: true,
      })
    );
  
    server.use(auth);
  
    server.get('/success', function(req, res) {
      res.json(req.session.shopify);
    });
  
    server.get('/fail', function(req, res) {
      res.send('Authentication failed');
    });
  
    server.listen(port, () =&gt; {
      console.log(`&gt; Ready on http://localhost:${port}`);
    });
  });
  </code></pre>
  
  <p>Anyone have any insight?</p>