TypeError: methods[method] is not a function

Hello. I was trying to create some sort of addon to a npm package, but I’ve get the error of the title.
Here’s the code:

var methods = {
	fetch: require('../lib/fetch.js'),
	set: require('../lib/set.js'),
	delete: require('../lib/delete.js'),
	push: require('../lib/push.js'),
	add: require('../lib/add.js'),
	subtract: require('../lib/subtract.js'),
	fetchAll: require('../lib/fetchAll.js'),
	startsWith: require('../lib/startsWith.js'),
	createWebview: require('../lib/createWebview.js'),
	table: require('../lib/table.js'),
	setupServer: require('../lib/setupServer.js')
}


if (typeof keys === "undefined" || keys === null) {
	var keys = {}
}
module.exports = {

	version : '0.0.4-dev.16',
	
	// Fetch
	fetch: function(key, ops) {
    if (!key) throw new TypeError('No key specified. Need Help? DM DarkenLight Mage#2401');
    return arbitrate('fetch', {id: key, ops: ops || {}});
  },
	
	// Set
	set: function(key, value, ops) {
    if (!key) throw new TypeError('No key specified. Need Help? DM DarkenLight Mage#2401');
    if (value === undefined) throw new TypeError('No value specified. Need Help? DM DarkenLight Mage#2401');
    return arbitrate('set', {stringify: true, id: key, data: value, ops: ops || {}});
  },
	
	// Add
	add: function(key, value, ops) {
    if (!key) throw new TypeError('No key specified. Need Help? DM DarkenLight Mage#2401');
    if (isNaN(value)) throw new TypeError('Must specify value to add. Need Help? DM DarkenLight Mage#2401');
    return arbitrate('add', {id: key, data: value, ops: ops || {}});
  },
	
	// Subtract
	subtract: function(key, value, ops) {
    if (!key) throw new TypeError('No key specified. Need Help? DM DarkenLight Mage#2401');
    if (isNaN(value)) throw new TypeError('Must specify value to add. Need Help? DM DarkenLight Mage#2401');
    return arbitrate('subtract', {id: key, data: value, ops: ops || {}});
  },
	
	// Push
	push: function(key, value, ops) {
    if (!key) throw new TypeError('No key specified. Need Help? DM DarkenLight Mage#2401');
    if (!value && value != 0) throw new TypeError('Must specify value to push. Need Help? DM DarkenLight Mage#2401');
    return arbitrate('push', {stringify: true, id: key, data: value, ops: ops || {}});
  },
  
	// Delete
	delete: function(key, ops) {
    if (!key) throw new TypeError('No key specified. Need Help? DM DarkenLight Mage#2401');
    return arbitrate('delete', {id: key, ops: ops || {}});
	},
	
	// All
	all: function(ops) { 
    return arbitrate('all', {ops: ops || {}});
	},
  
	fetchAll: function(ops) { 
    return arbitrate('all', {ops: ops || {}});
	},
	
	// Table
	table: function(tableName) {
  
	// Set Name
    if (typeof tableName !== 'string') throw new TypeError('Table name has to be a string. Need Help? DM DarkenLight Mage#2401');
    else if (tableName.includes(' ')) throw new TypeError('Table name cannot include spaces. Need Help? DM DarkenLight Mage#2401');
	return arbitrate('table', {tableName: tableName})
    },
	
    // Login
	login: function(domain, password) {
		if (typeof domain !== 'string') throw new TypeError('Domain has to be a string. Need Help? DM DarkenLight Mage#2401');
		else if (domain.includes(' ')) throw new TypeError('Domain cannot include spaces. Need Help? DM DarkenLight Mage#2401');
		
		if (typeof password !== 'string') throw new TypeError('Password has to be a string. Need Help? DM DarkenLight Mage#2401');
		else if (password.includes(' ')) throw new TypeError('Password cannot include spaces. Need Help? DM DarkenLight Mage#2401');
		
		return arbitrate('login', {domain: domain, password: password, ops: {}})
	},
	
	// setupServer
	setupServer: function(password) {
		return arbitrate('setupServer', {password: password, ops: {}})
	},
  }
  
	
	
  function arbitrate(method, params) {
  if (keys) {

  // Verify Options
  if (params.ops.target && params.ops.target[0] === '.') params.ops.target = params.ops.target.slice(1); // Remove prefix if necessary
  if (params.data && params.data === Infinity) throw new TypeError(`You cannot set Infinity into the database @ ID: ${params.id}`)
  
  // Stringify
  if (params.stringify) {
    try { params.data = JSON.stringify(params.data); } catch (e) 
    { throw new TypeError(`Please supply a valid input @ ID: ${params.id}\nError: ${e.message}`); } 
  }
  
  // Translate dot notation from keys
  if (params.id && params.id.includes('.')) {
    let unparsed = params.id.split('.');
    params.id = unparsed.shift();
    params.ops.target = unparsed.join('.');
  }
  
  
  // Run & Return Method
  return methods[method](params, keys);
  } else {
	  if (method === 'login') {
		  return methods['login'](params, keys)
	  } else throw new TypeError('No domain/password specified. Please use the login function to set the domain and the password.');
	 }
}

It works very well in here (the package I used as base): https://github.com/TrueXPixels/quick.db/blob/glitch/bin/handler.js

What’s happening?