AWS DynamoDB error: ValidationException: One or more parameter values were invalid: Condition parameter type does not match schema type

Executing a query against a Global Secondary Index I got this error:

ValidationException: One or more parameter values were invalid: Condition parameter type does not match schema type

Using the NodeJS Document api, my query looked like this:

let params = {
        "TableName": "exampletable",
        "IndexName": "example-createdate-index",
        "KeyConditionExpression": "exampleattr1 = :exampleattr1",
        "ExpressionAttributeValues": {
            ":exampleattr1": { "S": "0" }
        },
        "ProjectionExpression": "createdate, exampletext",
        "ScanIndexForward": false
    }
return docClient.query(params).promise();

The error is saying that one of my query parameter types does not match the values in the schema. I know this value is a String so this looks correct. Following recommendations on this question, it’s suggested to not pass the param type as “S” and let the Document api work out the type itself.Remove the “S” and just passed the value and now it’s working as expected.

gp-pages deploy fails when run from GitHub Action: Author identity unknown

I’m calling gh-pages from a GitHub Action, and at the point when gh-pages is called by the Action, it fails with this error:

> gh-pages -d build

Author identity unknown

*** Please tell me who you are.

Following this recommendation on a similar posted issue, I updated the ‘npm run build’ script in my package.json to pass the -u option with the github-actions-bot userid:

    "deploy": "gh-pages -d build -u 'github-actions-bot <support+actions@github.com>'",

After adding this and re-running, now I have a different error:

> gh-pages -d build -u 'github-actions-bot <support+actions@github.com>'

fatal: could not read Username for 'https://github.com': No such device or address

Apparently to allow the Action to use actions/checkout to access your repo you must use a Personal Token per additional instructions here.

To create a new access token, access your account settings, then Developer Settings:

To add the token value as a secret to your project, add a new secret via settings on the repo that your Action is accessing:

After paying more attention to the Action log, the checkout step was actually working and completing as expected, it was the ‘npm run deploy’ step that was failing with same error as shown in the linked post above. Following the same advice to use the access token to resolve the ‘Could not read username’ error, I updated the ci.yml again to add the reference to the token as part of setting the remote repo url:

- name: Deploy
  env:
    MY_EMAIL: kevin.hooke@gmail.com
    MY_NAME: kevinhooke
  run: |
    git config --global user.email $MY_EMAIL
    git config --global user.name $MY_NAME
    git remote set-url origin https://$MY_NAME:${{ secrets.GH_SECRET }}@github.com/kevinhooke/my-example-project.git
    npm run deploy
  • the git config steps set the git user’s email and name properties within the context of the Github Action
  • the ‘git remote set-url’ specifies the repo url including my userid and the Personal Access Token retrieved from the GitHub Secret.

Problem solved, now the action works as expected and publishes this project’s GitHub pages on every commit!

Principals and techniques are more valuable that specific skills

It seems like everyone wants to learn to program and become a developer nowdays, which is great, but there’s a noticeable trend online of people asking how to learn language xyz in the shortest amount of time imaginable and get a job by next month, which is a completely unrealistic expectation.

We all have bills to pay, I get it. However, whereas learning how to build a simple HTML page today may get you your first job and keep you busy for a few months, it may not keep you employed for long if you’re not prepared to keep your skills up to date and keep up with the industry trends.

Technologies in software development change quick. What’s hot this year may be out of date the next year. You need to commit to investing in keeping your skills up to date and to stay current with the current skill demands. If you’re a relatively new developer or are just getting started, it would help to do some research about programming languages and frameworks to get an understanding of how quickly things have changed in the past. In the early 2000s for example, every Java based web application was built with Apache Struts and it was replaced with Spring MVC (and a few others) in the space of a couple of years. Web frameworks have a significantly quick turnover. JavaScript based web frameworks and libraries have come and gone in the last few years at an alarming rate – jQuery used to be everywhere and is now is a second choice (or not even considered) over the main frameworks dominating this space, Angular, React and Vue.

It’s important to keep in perspective that programming languages are tools, and learning a programming language alone does not make you a developer. A comparison is learning to use a hammer when intending to get a job as a framer building houses – it’s more obvious to see how ridiculous that expectation is, but the same thing applies to only learning a programming language.

Principals and techniques are reusable and transferrable skills, no matter what programming language you are using. Focus on developing your software development skills first, and secondly a programming language.

A career in software development is a career of continual learning and keeping your skills up to date. Regularly invest in your skills and you’ll be able to enjoy a long and rewarding career in software development.