blogging

AWS S3: SignatureDoesNotMatch (getSignedUrl)

Setup a new S3 Bucket with IAM User, and went to upload the file after making a call to getSignedUrl. I thought I had everything right. Double/triple checked everything. Turns out the initial Access key ID I received from AWS just didn’t work. Created a new one, and magic.

Apparently, I’m not the only one who has encountered this baffling issue and magically solution. Hope this helps anyone else who encounters the error: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method.

blogging

Metro Bundler error: Invalid regular expression | node > 12.9 Windows

TLDR: If you’re doing React Native Expo development on a Windoze machine and have node version > 12.9 Metro Bundler will fail with a regex error:

error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class.

Seems like two fixes for this:

  1. Downgrade your version of node, as stated on this expo-cli GitHub ticket
  2. Update the regex in metro-config/src/defaults/blacklist.js:
    from

    var sharedBlacklist = [
      /node_modules[/\\]react[/\\]dist[/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/

    ];

    to

    var sharedBlacklist = [
      /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/
    ];
    note the additional escapes in the expr: /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
    the difference is very subtle

Hoping this helps anyone encountering this issue. If you don’t downgrade node (which might not be an option for everyone), then every new project or any time you npm i, you’ll need to perform this regex replacement in the metro-config/src/defaults/blacklist.js file.

blogging

Email field with space in React 16 backspace issue

TLDR: There’s an “issue” with backspace in an input type=email field and React 16 that has a conversation going on here.

While working on a React project, a testing “issue” came up while testing an email input field. I use “air quotes” here because… Well, spaces in email fields aren’t really a thing you’d happen upon in common real-world scenarios. Nonetheless, it’s a legitimate (albeit, non-critical) issue that you may encounter during dev/testing of a React app.

A tester was testing a login form and entered “Here is a test” into the email field to test if the field validation was working. Sure enough, that input was identified as an invalid email address. Okay! Time to go home. Until they tester started backspacing in the email field and found the cursor suddenly jump to the beginning of the field when backspacing over the space. In other words, the cursor jumped from the a to before the H at the very beginning of the email field and did not delete/backspace over the text.

After sleuthing, I found the above mentioned link. Linked here again if anyone encounters the same “issue” while testing backspacing in an input type=email field while developing in React. GitHub poster’s fiddle demonstrating the issue can be found here.

blogging

npm install bcrypt fails on Windoze

Getting started with a fresh windoze dev environment and went to install the npm bcrypt package. Ended up with an error while building… Found many recommendations to just install bcryptjs, which wasn’t an option I was interested in. Found some sage advice of (Powershell with Admin rights):

//Temporarily disable Real-time protection within Windoze Defender
npm install -g node-gyp
npm install -g --production windows-build-tools

went with that instead. npm i bcrypt worked like a charm!