简体   繁体   English

放大 - NextJS - 访问 lambda 日志

[英]Amplify - NextJS - Access lambda logs

In the AWS Amplify dashboard I can't see a way to access my /api/* route logs after deploying a hello world NextJS application.在 AWS Amplify 控制面板中,我看不到在部署 hello world NextJS 应用程序后访问我的 /api/* 路由日志的方法。 Where would these be located?这些将位于何处?

Steps:脚步:

  1. init extremely simple helloworld nextjs application with /api/hello.js export default (_, res) => res.send("hello world")使用 /api/hello.js 初始化极其简单的 helloworld nextjs 应用程序export default (_, res) => res.send("hello world")
  2. Deploy to amplify部署放大
  3. /api/hello returns "hello world" /api/hello 返回“你好世界”

Can't find the logs for this lambda function nor find it anywhere in AWS or the Amplify dashboard.无法找到此 lambda function 的日志,也无法在 AWS 或 Amplify 控制面板中的任何位置找到它。 Even after enabling "Amplify Studio" I can't see it listed under 'Functions' but obviously I can call the endpoint without enabling Amplify Studio at all.即使在启用“Amplify Studio”之后,我也看不到它列在“功能”下,但显然我可以在根本不启用 Amplify Studio 的情况下调用端点。

I can see a handler for /api/* in cloudfront distribution but can't find where the handler is.我可以在云端分发中看到 /api/* 的处理程序,但找不到处理程序的位置。

Once is deployed with Amplify, go to the build page and look in the Deploy tab.使用 Amplify 部署后,go 到构建页面并查看Deploy选项卡。 You will find a row that says [INFO]: - API Lambda@Edge: xxxxxxx-xxxxxxx .您会发现一行显示[INFO]: - API Lambda@Edge: xxxxxxx-xxxxxxx The ID you see will be needed to identify the logs inside AWS CloudWatch .将需要您看到的 ID 来识别AWS CloudWatch中的日志。

The logs can be found going to CloudWatch -> Log groups and then you can find the API logs following this pattern: /aws/lambda/<region: this will probably be 'us-east-1'>.xxxxxxx-xxxxxxx可以在CloudWatch -> Log groups中找到日志,然后您可以按照以下模式找到 API 日志: /aws/lambda/<region: this will probably be 'us-east-1'>.xxxxxxx-xxxxxxx

Amplify now provides an easy shortcut to go straight to the cloudwatch logs: Amplify 现在提供了一个简单的快捷方式,可以直接通过 go 访问 cloudwatch 日志:

  • Under app settings in amplify click monitoring在放大点击监控的应用程序设置下
  • Then select the hosting compute logs tab然后是 select 托管计算日志选项卡
  • Then you will have a link for logs for each branch you have deployed然后,您将获得已部署的每个分支的日志链接

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Lambda@Edge 在 Amplify 上部署 NextJs SSR 应用程序(503 错误) - How to Deploy NextJs SSR app on Amplify with Lambda@Edge (503 Error) 放大 lambda function “无权访问类型 [型号] 上的 [功能]” - Amplify lambda function "Not Authorized to access [function] on type [model]" AWS 放大 REST API Lambda Function 403 {“消息”:“拒绝访问”} - AWS Amplify REST API Lambda Function 403 {"message":"Access Denied"} 在 AWS Amplify 上使用@sentry/nextjs 构建 NextJS 时出错 - Error building NextJS with @sentry/nextjs on AWS Amplify 放大 NextJs 应用中的 GraphQL No Credentials 错误 - Amplify GraphQL No Credentials Error in NextJs Application 在 AWS Amplify 上使用 NextJS 按需重新验证 - Using NextJS On Demand Revalidation on AWS Amplify 使用 NextJS 和 Amplify 的 AWS Cognito 登录 - 在前端或后端调用端点? - AWS Cognito Signin with NextJS and Amplify - call endpoint on front or backend? 在哪里可以找到 AWS Amplify Logger 日志 - Where to find AWS Amplify Logger logs 如何将 Sam 与 lambda 和发电机一起使用并放大? - How to use Sam with lambda and dynamo and amplify? Datadog Lambda 扩展日志延迟 - Datadog Lambda Extension Logs delayed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM