We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Good Day.
I just noticed that installing npm install --save-dev serverless-plugin-tracing is not enough to use this plugin.
npm install --save-dev serverless-plugin-tracing
I have struggled for serveral days to find the way how to run my application without error.
so I just found the cause that aws-xray-sdk package is not installed in my project.
aws-xray-sdk
after I installed aws-xray-sdk, my project started working well and I can see the Service map in AWS X-Ray screen.
Service map
AWS X-Ray
Am I only person who have this problem?
I don't know about details but just let you guys know.
Here's my serverless.yml and handler.js. and I am using next.js and node.js 8 with Koa.
serverless.yml
handler.js
next.js
node.js 8
Koa
service: mom # NOTE: update this with your service name provider: name: aws runtime: nodejs8.10 stage: ${self:custom.stageName} region: ap-northeast-2 tracing: true # enable tracing environment: NODE_PATH: "./:/opt/node_modules" stageName: ${self:custom.stageName} iamRoleStatements: - Effect: "Allow" # xray permissions (required) Action: - "xray:PutTraceSegments" - "xray:PutTelemetryRecords" Resource: - "*" custom: stageName: NextJS package: individually: true exclude: - .cache - .serverless - .vscode - serverless.yml functions: frontendAdmin: handler: handler.index name: ideasam-mom-frontendAdmin # optional, Deployed Lambda name description: MOM - match admin page # optional, Description to publish to AWS # environment: ${self:custom.environment} memorySize: 512 package: exclude: - frontend/test - frontend/"**.test.js" - frontend/"__snapshots__/" include: - frontend/.next/** events: # - http: # path: /admin # method: get # cors: true - http: path: /admin/{addr+} method: get cors: true layers: - arn:aws:lambda:ap-northeast-2:***:layer:***:1 ... plugins: - serverless-offline - serverless-plugin-tracing
'use strict' const debugging = process.env.DEBUG || process.env.DEBUG === 'true' let layerPath = '' if (debugging) { layerPath = require('./layerPath').layerPath(__dirname.substring(0, __dirname.lastIndexOf('/'))) } const serverless = require(layerPath + 'serverless-http') const server = require('./server_koa') module.exports.index = async (event, context) => { try { /** * @author 박태성 * @name AWS_X-Ray * @description AWS X-Ray 적용을 위한 코드. 디버깅 모드에서는 지원되지 않음. aws-xray-sdk를 추가로 인스톨해야 Prod에서 사용 가능. */ if (!debugging) { const awsXRay = require('aws-xray-sdk') const awsSdk = awsXRay.captureAWS(require('aws-sdk')) } const appServer = await server.createServer(event) return await serverless(appServer)(event, context) } catch (e) { console.log('error in handler.js', e) return { statusCode: 500, headers: { 'content-type': 'text/html', }, body: ` <html> <body style="margin: 0px; padding: 1rem; background-color: #ff0081;"> <div style="color: #fff;">${e.message}</div> </body> </html> `, } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Good Day.
I just noticed that installing
npm install --save-dev serverless-plugin-tracing
is not enough to use this plugin.I have struggled for serveral days to find the way how to run my application without error.
so I just found the cause that
aws-xray-sdk
package is not installed in my project.after I installed
aws-xray-sdk
, my project started working well and I can see theService map
inAWS X-Ray
screen.Am I only person who have this problem?
I don't know about details but just let you guys know.
Here's my
serverless.yml
andhandler.js
.and I am using
next.js
andnode.js 8
withKoa
.serverless.yml
handler.js
The text was updated successfully, but these errors were encountered: