question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No apiConfig defined on module 'app'. Are you missing a module.exports?

See original GitHub issue

With the following, which sits inside a folder api/app.js, in the package.json file for the project I have "files": "api/*.js

/*global require, module*/

var APIBuilder = require('claudia-api-builder');
var api = new APIBuilder();
var Promise = require('bluebird');
var pg = require('pg');

module.exports = api;

api.get('/app', function() {

  return new Promise(function(resolve, reject) {

    var client = new pg.Client('<connection string>');

    client.connect(function(error) {
      if (error) {
        return reject(error);
      }

      client.query('SELECT * FROM apps', function(error, results) {

        if (error) {
          return reject(error);
        }

        var output = results.map(function(result) {
          return {
              // Map return in here
          }
        });

        return resolve(output);
      });
    })
  });
});

I get the error in the title after running:

claudia create --name appname --region eu-west-1 --api-module app

The full output is:

server listening on port: 4001
No apiConfig defined on module 'app'. Are you missing a module.exports?

No claudia.json file is created either

I’ve tried to follow the example as close as possible, although this code lives in an existing project that is a static app, and rather than have a separate repo I am keeping the lamda functions within the api folder to deploy.

Any ideas?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gojkocommented, Mar 29, 2016

this is now available on NPM as 1.1.0. I’ve made the new version fully backwards compatible, so there was no need to bump major version.

1reaction
gojkocommented, Mar 15, 2016

I’ve never tried to create a lambda with a function in a subfolder; this might be a limitation of the lambda nodejs engine, not sure. I’ll investigate that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - TypeError: Cannot read properties of undefined ...
currentweather.js exports a function which returns an instance of Sequelize's CurrentWeather , while you're trying to act as if the function ...
Read more >
foreverjs/forever - Gitter
What is the error that you are getting? ... (node:733992) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
Read more >
How to Develop a Boilerplate for API with Node.js, Express ...
Now we are set and ready for Express API boilerplate development. ... api routes v1 app.use('/api/v1', api(config)); module.exports = app;.
Read more >
node-api-auth - npm Package Health Analysis - Snyk
You can define routes by adding new files in the api/routes folder, for example: "use strict"; module.exports = function ( app, ...
Read more >
reste - npm
exports. ... (If your Titanium app does not use node modules already, ... now we can do our one-time configure api.config({ debug: true, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found