Re-writing previous git commits to change committer author/email

If you’ve committed a number of git commits using a wrong user.name or user.email value, you can re-write previous commits with:

git filter-branch --commit-filter '
        if [ "$GIT_COMMITTER_NAME" = "Old Name" ];
        then
                GIT_COMMITTER_NAME="new-name";
                GIT_AUTHOR_NAME="new-name";
                GIT_COMMITTER_EMAIL="new-email";
                GIT_AUTHOR_EMAIL="new-email";
                git commit-tree "$@";
        else
                git commit-tree "$@";
        fi' HEAD

Note that this will re-write all commits on the current branch matching the if condition which may or may not be what you’re looking for, so be careful. push the changes back to your remote origin as needed.

This is based on answers to this question here.

React app running locally failing with opensslErrorStack ERR_OSSL_EVP_UNSUPPORTED

I just started getting this error starting up my React app locally with ‘npm run start’ :

opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'

I recently installed nvm on my Mac to avoid needing sudo for running a ‘npm i -g’, and also apparently picked up the latest stable node version and not lts.

Running ‘nvm ls’ to see what version I have and what’s available:

> nvm ls
->      v17.3.0
         system
default -> node (-> v17.3.0)

According to https://nodejs.org/en/download/current/ 17.3.0 is the latest current and not lts. Answers to this related question suggested switching back to lts to avoid this change.

Following the nvm docs :

nvm install -lts
nvm use --lts

Now I’ve back at version 16.13.1, and my React app with ‘npm run start’ now starts as expected.

AWS connect-streams api testing locally: issues and workarounds

To initialize the Connect CCP using amazon-connect-streams api in a webpage locally there are several steps to configure. The most likely errors if you haven’t followed all the steps is a X-Frame-Options sameorigin error which you’ll see in your devtools console:

… or a Content Security Policy error if you haven’t added your origin url to Connect’s allowed origins:

Add your origin url to Connect following steps here. If you’re loading from an http server locally, you need to add the full url and port, e.g. https://localhost:8080

Allow cookies: if your default browser settings are to block third-party cookies from different origins, this will prevent the app from loading (you’ll get the same X-Frame-Options error which is confusing). Make sure you allow all the cookies from [your-connect-instance-name].awsapps.com – in the screenshot these should all be allowed:

http-server with self-signed certs and enabling support in Chrome

To test loading a site locally with http-server you need to generate self-signed certs:

openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 -keyout key.pem -out cert.pem

Now start up http-server using the new cert:

http-server -S -C cert.pem -o .

If you attempt to browse https://localhost:8080 though, Chrome will block self-signed certs by default. To allow self-signed certs, enter in your Chrome address bar:

chrome://flags/#allow-insecure-localhost

And then enable the highlighted setting: