title: Running into a 403 error with nodejs and aws
body: <p>The relevant packages I'm using are <code>aws-sdk</code>, <code>multer-s3</code>, and <code>multer</code>.</p>
  <p>I have the upload setup as such:</p>
  <pre><code>aws.config.update({
      secretAccessKey: &quot;accessKey&quot;,
      accessKeyId: &quot;keyId&quot;,
      region: &quot;eu-west-2&quot;
  });
  
  var s3 = new aws.S3();
  
  const upload = multer({
      storage: multerS3({
          s3,
          acl: &quot;public-read&quot;,
          bucket: &quot;my-buckets-name&quot;,
          metadata: function(req, file, cb) {
              console.log(&quot;passed1&quot;); // prints
              cb(null, {
                  fieldName: &quot;file.fieldname&quot;
              });
          },
          key: function(req, file, cb) {
              console.log(&quot;passed2&quot;); // prints
              cb(null, Date.now().toString());
          }
      })
  });
  </code></pre>
  <p>My route goes something like this,</p>
  <pre><code>router.post(
          &quot;/single&quot;,
          [auth, upload.single(&quot;image&quot;)],
          async (req, res) =&gt; {
                  console.log(&quot;hereiam&quot;); // never reached
                  res.json({
                      msg: &quot;Server received media. Processing...&quot;
                  });
  
                  if (mediaType === &quot;image&quot;) {
                      try { /*...*/ } catch { /*...*/ }
                  } else { /*...*/ }
  </code></pre>
  <p>Both of the <code>passed1</code> and <code>passed2</code> are outputted to the console, and I'm positive that my access key and key ID are correct. When I try to upload an image, I'm thrown a 403 error.</p>
  <p>I'm using react native, and I was doing</p>
  <pre><code>const aws = require(&quot;aws-sdk/dist/aws-sdk-react-native&quot;);
  </code></pre>
  <p>That gave me absolutely no feedback at all, the program just continued going as if it nothing happened after I clicked &quot;upload.&quot;</p>
  <p>Then I changed the nodejs import to,</p>
  <pre><code>const aws = require(&quot;aws-sdk&quot;);
  </code></pre>
  <p>And now I'm being thrown a 403. Not sure what I'm doing wrong.</p>
  <hr />
  <h1>Edit:</h1>
  <p>Permissions of my S3:</p>
  <p><a href="https://i.stack.imgur.com/0hlxL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0hlxL.png" alt="img" /></a></p>