examples
examples copied to clipboard
aws-node-rest-api-typescript: Add Mongo/Atlas connection instructions
Following the instructions in README.md on running the app you will see {"message": "Internal server error"}
And a stack trace resembling
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
at NativeConnection.Connection.openUri (C:\Users\luke\src\luke-typescript-rest-api-app\node_modules\mongoose\lib\connection.js:693:11)
at C:\Users\luke\src\luke-typescript-rest-api-app\node_modules\mongoose\lib\index.js:345:10
at C:\Users\luke\src\luke-typescript-rest-api-app\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
I think this is because the Mongo/Atlas connection strings need to be set first. Would be handy to have how to do this in the readme.
I can confirm adding MongoDB Atlas connection details fixed the internal server error. These additional steps are needed:
- Set up a MongoDB Atlas DB + user, and make it accessible to AWS IPs as appropriate. (details omitted, probably better explained in an external doc).
- Add parameters to runtime environment in the serverless.yml file, e.g.
- In the serverless dashboard, add the parameters for the chosen environment, e.g.
- run
serverless deployagain