• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

error: Connection timed out after 1000ms For aws-sdk (amazonSES api)

Scheduled Pinned Locked Moved NodeBB Plugins
6 Posts 3 Posters 5.3k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Ken OKABE
    wrote on last edited by Ken OKABE
    #1

    I'm trying to develop nodebb-plugin-emailer-amazonses
    https://github.com/kenokabe/nodebb-plugin-emailer-amazonses

    Without nodeBB, I managed to success to send email along with amazonSES.
    The test code is
    https://github.com/kenokabe/nodebb-plugin-emailer-amazonses/blob/master/testapp.js
    with proper 'nodebb/node_modules/nodebb-plugin-emailer-amazonses/config.json'

    However, once implemented as nodebb plugin,
    error: Connection timed out after 1000ms
    occurs.

    In fact, commenting out

    var AWS = require('aws-sdk');
        AWS.config.loadFromPath('./config.json');
        var ses = new AWS.SES({apiVersion: '2010-12-01'});
    

    helps to succeed to install this plugin and launch nodeBB.
    So, somehow AWS.config process online fails.

    How does this happen? and how can I fix this?
    Please advice. Thanks!

    **Here's the log of ./nodebb dev
    **
    Launching NodeBB in "development" mode.
    ....
    ....
    info: [plugins] Loaded plugin: nodebb-plugin-emailer-amazonses
    ....
    ===========emailer-amazonses init============
    info: [sounds] Sounds OK
    info: [meta/js] Compilation complete
    info: [themes] Compiling templates
    info: [meta/css] Done.
    error: Connection timed out after 1000ms
    TimeoutError: Connection timed out after 1000ms
    at ClientRequest.<anonymous> (/home/ken/nodebb/node_modules/nodebb-plugin-emailer-amazonses/node_modules/aws-sdk/lib/http/node.js:51:34)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.EventEmitter.emit (events.js:92:17)
    at Socket.emitTimeout (http.js:1797:10)
    at Socket.g (events.js:180:16)
    at Socket.EventEmitter.emit (events.js:92:17)
    at Socket._onTimeout (net.js:326:8)
    at Timer.unrefTimeout [as ontimeout] (timers.js:418:13)
    info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    info: [app] Database connection closed.
    info: [app] Shutdown complete.

    1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    wrote on last edited by julian
    #2

    Hm, any chance you're not handling the err value when you make the call to aws using the aws-sdk module?

    Where does ./config.json point to, a config file in your plugin's root folder?

    K 1 Reply Last reply
    0
  • K Offline
    K Offline
    Ken OKABE
    replied to julian on last edited by Ken OKABE
    #3

    @julian said:

    Where does ./config.json point to, a config file in your plugin's root folder?

    Yes.
    ./config.json to be pointed by AWS.config.loadFromPath('./config.json'); in library.js
    is located on
    ~/nodebb/node_modules/nodebb-plugin-emailer-amazonses/config.json

    { "accessKeyId": "YOUR_AWS_API_ID",
      "secretAccessKey": "YOUR_SECRET",
      "region": "us-west-2" }
    

    Hm, any chance you're not handling the err value when you make the call to aws using the aws-sdk module?

    The current library.js is

    var winston = module.parent.require('winston'),
        Meta = module.parent.require('./meta'),
        Emailer = {},
        ses;
    
    Emailer.init = function (app, middleware, controllers)
    {
      console.log('===========emailer-amazonses init============');
      var AWS = require('aws-sdk');
      AWS.config.loadFromPath('./config.json');
      ses = new AWS.SES({
          apiVersion: '2010-12-01'
      });
    };
    //.............
    //...............
    

    Thanks.

    1 Reply Last reply
    0
  • K Offline
    K Offline
    Ken OKABE
    wrote on last edited by
    #4

    PS.

    I hardcoded Credentials, then it works at least for the plugin initialisation and nodeBB ready.

    Hard-Coding Credentials
    http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html

    So, probably
    AWS.config.loadFromPath('./config.json');
    This line somehow fails to import the credential info form the ./config.json = ( ~/nodebb/node_modules/nodebb-plugin-emailer-amazonses/config.json )

    Any idea how to fix this?

    1 Reply Last reply
    0
  • K Offline
    K Offline
    Ken OKABE
    wrote on last edited by
    #5

    Ok, the problem is SOLVED.

    For nodeBB plugin, the current directory is not plugin(nodebb-plugin-foo/) but nodebb root.

    So, I placed emailer-amazonses-config.json in nodebb root dir.

    Then modified the pointer in the code of the plugin.

    Thanks.

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #6

    Maybe it would be better to keep that config in the plugin's directory and then modify this line to:

    AWS.config.loadFromPath('./node_modules/nodebb-plugin-emailer-amazonses/config.json');

    ?

    Also, am looking forward to you releasing this plugin 🙂

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development