Skip to content

My code from following the Udemy course "Serverless Framework Bootcamp: Node.js, AWS & Microservices", with adjustments and workarounds to keep the project running in 2025.

Notifications You must be signed in to change notification settings

ElenaChes/sls-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Serverless practice - Microservices & AWS

This repo contains my code from following the Udemy course Serverless Framework Bootcamp: Node.js, AWS & Microservices.
Since the course is now outdated (tools, APIs, and AWS policies have changed significantly), I made adjustments and workarounds to keep the project running in 2025.
You can see the list of changes below - this may be useful for fellow students or anyone revisiting the course.

Note

For the original unmodified source code, see the instructor's repos:

Content


General Notes

Modules (ESM Syntax)

As of Node v22 (and earlier versions that support it), using the default file structure causes an Internal Server Error due to a module syntax mismatch:

{
  "errorType": "Runtime.UserCodeSyntaxError",
  "errorMessage": "SyntaxError: Cannot use import statement outside a module"
}

Rename all primary JavaScript files (Lambda handlers) from .js to .mjs. This explicitly tells Node.js to interpret them as modules.

Windows Commands

The standard command-line syntax shown in the course may fail on Windows terminals. I used the following syntax:

Deploy entire stack:

sls deploy --verbose

Deploy only one function:

sls deploy function -f createAuction --verbose

Listen to function logs:

sls logs -f processAuctions --tail

Invoke function manually:

sls invoke -f processAuctions --log

Remove Stack:

sls remove --verbose

Note

Ensure you're executing the commands in a Command Prompt (cmd) rather than the default PowerShell terminal in VS Code.

Unit Specific Changes & Workarounds

Serverless Isntallation (Unit 15)

When creating the template using:

sls create --name YOUR_PROJECT_NAME --template-url https://github.com/codingly-io/sls-base

I got an error - โœ– No configuration file found. Looking it up online I stumbled across a stackoverflow suggestion that suggested downgrading the Serverless installation:

npm i serverless@3.39.0 -g

Middy Installation (Unit 31)

This section caused a lot of problems on my end. The solution to all of them was just to downgrade middy to the versions mentioned in this question: I'm getting an error when calling getAuctions

npm install @middy/core@1.2.0 @middy/http-error-handler@1.2.0 @middy/http-event-normalizer@1.2.0 @middy/http-json-body-parser@1.2.0 @middy/validator@1.2.0

Auth Service Token (Unit 50)

I couldn't get the teacher's curl code to work for me (can't tell if it's because it changed or because I'm on Windows), but the following did the trick:

curl --request POST --url https://YOUR_AUTH0_DOMAIN/oauth/token --header "content-type: application/json" --data "{ \"client_id\": \"YOUR_AUTH0_CLIENT_ID\", \"client_secret\": \"YOUR_CLIENT_SECRET\", \"audience\": \"https://YOUR_AUTH0_DOMAIN.com/api/v2/\", \"username\": \"YOUR_USERNAME\", \"password\": \"YOUR_PASSWORD\", \"grant_type\": \"password\", \"scope\": \"openid\" }"

Additionally, at some point I got the error:
Connection must be enabled for this client to perform single user creation and signup operations
The fix was making sure my application settings were correct, using the example in this question: Invalid connection name Username-Password-Authentication. The connection does not exist.

Lastly, if you check your token on jwt.io and you're not seeing an email in the decoded payload, make sure you copied the id_token and not access_token.

Auth Service (Unit 51)

Deploying the Auth Service doesn't work as it did during the course's recording, a few changes need to be made to deploy auth-service.

I changed auth-service/serverless.yml from:

service:
	name: auth-service

plugins:
  - serverless-bundle

provider:
  name: aws
  runtime: nodejs12.x

To:

service: auth-service

provider:
  name: aws
  runtime: nodejs20.x

And it did the trick. If you're still getting an error, try deleting node_modules and running npm i again.

Notification Service (Unit 57)

Amazon SES changed quite a bit since the course was recorded. Instead of a Email Addresses, you need to go to:

  1. Identities (under Configuration).
  2. Click Create Identity.
  3. Select Email address.
  4. Enter your Email address.
  5. Click Create Identity.

Now you can check your email for the verification email.

Auction Bucket (Unit 68)

I got an error when trying to deploy the Bucket setup - CREATE_FAILED: AuctionsBucketPolicy.
The new default configuration for creating S3 Bucket Policies blocks public access, so the AuctionsBucket.yml needs to be updated from:

AuctionsBucket:
  Type: AWS::S3::Bucket
  Properties:
    BucketName: ${self:custom.AuctionsBucket.name}

To:

AuctionsBucket:
  Type: AWS::S3::Bucket
  Properties:
    BucketName: ${self:custom.AuctionsBucket.name}
    #[Make bucket public]
    PublicAccessBlockConfiguration:
      BlockPublicAcls: false
      BlockPublicPolicy: false
      IgnorePublicAcls: false
      RestrictPublicBuckets: false

Auction Picture (Unit 70)

I kept getting image contains errors when trying to view my uploaded image using the URL - uploading a .jpg fixed the problem.

Base64 Validation (Unit 74)

The strings I got from the teacher's encoder didn't end with = so I couldn't use a plain pattern: "=$".
Instead I found this useful question: Base64 Validation, providing a proper Base64 validation.

Setting up the Frontend (Unit 78)

The frontend demanded a lot of troubleshooting on my end, since close to all dependencies included are outdated.

NPM Install

The initial npm install failed due to the obsolete node-sass package and severe dependency conflicts (especially with mobx-react and React Hooks). The solution was a multi-step cleanup and update.

  1. Remove obsolete package:
npm uninstall node-sass
  1. Install replacement and a missing package that would cause an error later on:
npm install sass
npm install @material-ui/styles@4.11.5 --legacy-peer-deps
  1. Update package.json to these versions to fix the Invalid Hook error caused by useStyles():
"mobx": "^6.9.0",
"mobx-react": "^9.1.0",
"react": "16.14.0",
"react-dom": "16.14.0",
  1. Final cleanup:
  • Delete package-lock.json and node_modules.
  • Run:
npm install --legacy-peer-deps
npm dedupe

NPM Start Error

Running npm start also threw an error. The fix to this was changing the package.json scripts to the following:

"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider react-app-rewired start",

And installing:

npm install cross-env --save-dev

Now you can run npm start.

Crash on Open (Auth0 Configuration)

If the app opens but never gives you the login modal and crashes instead, make sure your Auth0 configuration is correct:

  • You copied the Client ID from the Default App and not the sls app.
  • The Domain is correct (no extra https:// or anything like that).
  • In the Default App settings, Application Type is set to Single Page Application.
  • The Default App settings have http://localhost:3000 at all the places where the sls app has them.

Can't Login with Email

To enable logging in with email (I had it off for some reason), head to:

  • Authentication -> Database.
  • Click the database.
  • Applications tab -> Make sure Default App is enabled.

Frontend Isn't Displaying Auctions

The final boss of all errors.
In short, mobx's inject & observer pattern was completely broken and failed to re-render the page on store changes.

I managed to get AuctionsPage.js to show the auctions by implementing a local React state to manually trigger a re-render after the data fetch:

import React, { useEffect, useState } from "react";

//...

const AuctionsPage = (props) => {
  const { auctionStore, authStore, routerHistory } = props;
  const [auctions, setAuctions] = useState([]); //for forcing re-renders
  const classes = useStyles();

  useEffect(() => {
    (async () => {
      await auctionStore.fetchAuctions(auctionStore.auctions);
      setAuctions(auctionStore.auctions); //re-render the page
      setInterval(() => {
//...

  const renderAuctions = () => {
    //const { auctions } = auctionStore;  //using state instead

    if (!auctions?.length) {

But even after many hours of troubleshooting I couldn't get the Bid button to work. BidModal.js never re-renders, likely because it also relies on the broken MobX observer pattern.
I hit the limit of time for frontend debugging. This is where I stop.

  • Login & registration work.
  • App displays auctions.
  • Creating an auction works. (including uploading an image!)
  • Bidding on an auction doesn't work.

About

My code from following the Udemy course "Serverless Framework Bootcamp: Node.js, AWS & Microservices", with adjustments and workarounds to keep the project running in 2025.

Topics

Resources

Stars

Watchers

Forks