Configuring region in Node.js AWS SDK

前端 未结 14 1555
失恋的感觉
失恋的感觉 2020-12-05 03:30

Can someone explain how to fix a missing config error with Node.js? I\'ve followed all the examples from the aws doc page but I still get this error no matter what.

14条回答
  •  难免孤独
    2020-12-05 04:17

    I have gone through your code and here you are connecting to AWS services before setting the region, so i suggest you to update the region first and then connect to services or create instance of those as below -

    var express = require('express');
    var router = express.Router();
    var AWS = require('aws-sdk');
    AWS.config.update({region:'us-east-1'});
    
    var dd = new AWS.DynamoDB();
    var s3 = new AWS.S3();
    var bucketName = 'my-bucket';
    

提交回复
热议问题