anomalyinnovations / serverless-stack-demo-ext-api Goto Github PK
View Code? Open in Web Editor NEWSource for the extended version of the demo app API in Serverless Stack.
Home Page: https://serverless-stack.com
License: MIT License
Source for the extended version of the demo app API in Serverless Stack.
Home Page: https://serverless-stack.com
License: MIT License
The TopicArn in billing.js appears to be the topic name, not an ARN:
Shouldn't this field be formatted as an ARN?
TopicName: arn:aws:sns:<REGION>:<AWS ID>:<TOPIC NAME>
Installed serverless-offline
Trying to debug the services in vscode.
The debugger runs the lambda but doesn't pause on break points inside lambda code.
Any idea how to make it work?
Here's launch.json object:
{
"type": "node",
"request": "launch",
"name": "setupStreaming",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceRoot}/node_modules/.bin/sls",
"cwd": "${workspaceFolder}/services/sessions",
"stopOnEntry": true,
"args": [
"invoke",
"local",
"--function",
"setupStreaming",
"--stage",
"dev",
"--path",
"./mocks/setupStreaming-event.mock.json"
]
}
Hi,
When i invoke the function locally with something like this, it works.
serverless invoke local -f get --path events/get-event.json
However when i try to do serverless offline it seems to screw up on the dynamoDB part and returns back a 500, { status: false}.
Also i deployed the resources and api as the guide suggested, and when i try hit the api gateway endpoint using postman i get the same 500, { status: false}. When i look on Xray to see whats wrong it says userId expected: S actual: NULL.
My guess is when i try postman the endpoint im not passing through the correct credentials. My header has a cognito-identity-id. In my authorisation i also have my aws access and secret key in it.
Can't seem to figure out the problem.
I've just done a fresh install with npm install
and tried to launch the local server with the ./startServer
but I got this error:
$ ./startServer
internal/modules/cjs/loader.js:613
throw err;
^
Error: Cannot find module 'http-proxy'
Require stack:
- C:\Users\stermi\dev\workspace_serverless\serverless-stack-demo-ext-api\startServer
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (C:\Users\stermi\dev\workspace_serverless\serverless-stack-demo-ext-api\startServer:5:19)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
how can I fix it?
hi everyone, it would be awesome if you could update the example to support the new serverless-bundle plugin that supports TS!
I recently updated my api app to use the updated logic in the libs folder of the demo api but now I'm transitioning my app to the ext format to deploy on seed but the ext app hasn't been updated with the new logic.
Demo API Version
import AWS from "aws-sdk";
const client = new AWS.DynamoDB.DocumentClient();
export default {
get : (params) => client.get(params).promise(),
put : (params) => client.put(params).promise(),
query : (params) => client.query(params).promise(),
update: (params) => client.update(params).promise(),
delete: (params) => client.delete(params).promise(),
};
EXT version
import AWS from "./aws-sdk";
import config from "../config";
const dynamoDb = new AWS.DynamoDB.DocumentClient();
export function call(action, params) {
// Parameterize table names with stage name
return dynamoDb[action]({
...params,
TableName: `${config.resourcesStage}-${params.TableName}`
}).promise();
}
Looks like we just need to spread the params into the table name stage.
get: (params) => client.get({
...params,
TableName: `${config.resourcesStage}-${params.TableName}`
}).promise()
Hi,
this is more an idea or proposal than an issue.
I would be really great if there would be also one service with serverless.yml for frontend (for example react).
Working with the tutorial here: https://serverless-stack.com/chapters/share-an-api-endpoint-between-services.html
However even after adding the following export:
resources:
Outputs:
ApiGatewayRestApiId:
Value:
Ref: ApiGatewayRestApi
Export:
Name: ${self:custom.stage}-ApiGatewayRestApiId
ApiGatewayRestApiRootResourceId:
Value:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
Export:
Name: ${self:custom.stage}-ApiGatewayRestApiRootResourceId
and the following import:
apiGateway:
restApiId:
'Fn::ImportValue': ${self:custom.stage}-ApiGatewayRestApiId
restApiRootResourceId:
'Fn::ImportValue': ${self:custom.stage}-ApiGatewayRestApiRootResourceId
I still get the same error from all three APIs who are trying to reference the already existing API.
Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template
at /tmp/seed/source/apis/saascharge/node_modules/serverless/lib/plugins/aws/deploy/lib/validateTemplate.js:20:13
at tryCatcher (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/tmp/seed/source/apis/saascharge/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)
Steps I have taken to debug:
Verified that the export is being deployed prior to the import
Verified that the syntax matches the tutorial above.
Is this tutorial just out of date? Any nudges in the right direction would be greatly appreciated.
Hi. Got this when running sls deploy
from services/notes-api
.
sls deploy
Serverless: Bundling with Webpack...
Serverless: Packaging service...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service create.zip file to S3 (761.74 KB)...
Serverless: Uploading service get.zip file to S3 (761.87 KB)...
Serverless: Uploading service list.zip file to S3 (761.88 KB)...
Serverless: Uploading service delete.zip file to S3 (761.7 KB)...
Serverless: Uploading service update.zip file to S3 (762.35 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..
Serverless: Operation failed!
Serverless: View the full error output: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aus-east-1%3A892036928957%3Astack%2Fnotes-app-ext-notes-api-dev%2Fa664cef0-21f5-11ea-94cc-0ef4281dfc4d
Serverless Error ---------------------------------------
An error occurred: notes-app-ext-notes-api-dev - No export named dev-ExtNotesTableArn found.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 10.16.0
Serverless Version: 1.49.0
Enterprise Plugin Version: 1.3.6
Platform SDK Version: 2.1.0
Is it a hard requirement to use X-ray. Getting packages not found when deploying the service functions separately.
The table names are still hard coded as ext-notes in the functions, shouldn't they be something like $serviceName-$stage-$functionName as mentioned in the guide?
"devDependencies": {
"aws-sdk": "^2.541.0",
"serverless-bundle": "^1.2.5",
"serverless-offline": "^5.12.0"
},
Just wondering if there is any reason for this? As we are in 3.1.0 for serverless-bundle for example.
Assuming my understanding of the hats are correct
It will update you to the most recent major version (the first number). ^1.2.3 will match any 1.x.xrelease including 1.3.0, but will hold off on 2.0.0.
Cheers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.