[error] Add a Create Note API

Add a Create Note API
I’m new to webdev and loving this website. Sadly I am already getting an error so early into the lesson.

When I put serverless invoke local --function create --path mocks/create-event.json into the CMD I get an error saying DOTENV: Could not find .env file. and Function "create" doesn't exist in this Service

What have I missed? Thanks for your help :slight_smile:

Could someone help? I have gone through the tutorial twice starting from scratch and the problem persists :frowning:

Solved it. It was something silly

1 Like

Did you ever figure out what it was? I’m receiving this error now, along with statusCode 400.

Serverless: DOTENV: Could not find .env file.
Serverless: Bundling with Webpack...
{ ResourceNotFoundException: Requested resource not found
 message: 'Requested resource not found',
  code: 'ResourceNotFoundException',
  time: 2019-11-12T08:16:46.197Z,
  requestId: 'O5LI8AEI4I5684BOHKTA9DUFD3VV4KQNSO5AEMVJF66Q9ASUAAJG',
  statusCode: 400,
  retryable: false,
  retryDelay: 2.463639380610516 }
{
    "statusCode": 500,
    "headers": {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Credentials": true
    },
    "body": "{\"status\":false}"
}

EDIT: fixed the environment problem by renaming env.example to .env like the readMe says to however still getting this resourcenotfoundexception

Hey Hai-der,

Welcome to the community!

Are you still experiencing with this issue? If so,
can you please provide a screen shot of your file structure, serverless.yml file codes, and the create.js file codes from your code editor.

Thank you!

2 Likes

Hey @anchenqq,
I figured it out, although I don’t quite remember how so I apologize to those in the future reading with the same problem. xD

Resource not found is a DynamoDB error.

Anyone having this problem be sure to check for two things:

your region is configured in aws-cli to the same one your DynamoDB is located and that it matches your serverless.yml

Also make sure your params are using the same primary key and sort key you used.
Also the table name is the same as the one in your DynamoDB instance

3 Likes

Thanks for posting. I’m sure it’ll help other folks!

Had the same issue, this solution worked! Thank you!

Looked on my DynamoDB dashboard and it was set at US-West. Deleted the table and hit the location in the navbar and selected N. Virginia. Then I made a fresh notes table.

The tutorial doesn’t clearly mention you need to switch in the navbar before you create the table. Cost me some time to troubleshoot the problem.

1 Like