Add a Create Note API

Good call. Glad you figured it out.

You saved me man, I literally was wrecking my head about why such a simple command wouldn’t work and would simply go to a new line almost like it was executed but not outputting anything. (Some old issues even pointed to a serverless version not being up to date ). And when I read this and when I realized that somehow I was outside of the scope of my root folder I did a strong facepalm. Thanks a lot :slight_smile:

1 Like

Thanks for that, helped me out, as I was having problems due to eslint formatting rules :slight_smile: This solved it :slight_smile:

1 Like

I keep getting statusCode 500 with ‘Requested resource not found’. I didn’t notice the ‘env example’ file, I’ve renamed it to ‘.env’, added

tableName=notes

but that doesn’t seem to solve the problem as I keep getting ‘{ ResourceNotFoundException: Requested resource not found’

Here’s the content of my .env.

tableName=notes

This is what the serverless.yaml contains:

    environment:
        tableName: notes

I’ve also checked the table in the DB and it’s named ‘notes’

UPDATE:

for some reason I had my table and everything else created on the region:us-east-2 and all the settings in serverless.yml were using us-east-1 :slight_smile: changed it to 2 and it worked :wink:

also, it’d be good to mention in the tutorial that you NEED to create .env and add there tableName=nameOfYourTableInDynamoDB

I know that there’s a README, but when I followed the tutorial, I didn’t focus on exploring the files. perhaps my bad!

Glad you figured it out!

A week ago, version 7.0 of the uuid package was released.

This release had a breaking change from the prior version of 3.x, the default export was removed.

The code in create.js errors out when run with: “TypeError: Cannot read property ‘v1’ of undefined” on line 22:

noteId: uuid.v1(),

To fix this, the import statement in line 1 should be changed to:

import { v1 as uuidv1 } from 'uuid';

And then line 22 should be:

noteId: uuidv1(),

*** If you were unlucky enough to install the 7.0.0 version, it introduced another bug when invoking the Lambda. “Error: uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.” To resolve this, npm upgrade uuid to get 7.0.1 or higher. See issue 378: https://github.com/uuidjs/uuid/issues/378 ***

I hope this helps anyone else who gets stuck here.

I’m new to this guide, but I can also do a PR for the change if that makes sense