重新部署后不会触发自定义授权方

问题描述

除了有时重新部署后,在命中 lambda 函数之前根本不会触发自定义授权方之外,一切都运行良好。然后我们将禁用授权者缓存并启用它,然后它开始工作。 这是授权人的样子:

public class scoreboard {
    
    private int computerWins;
    private int playerWins;

    public scoreboard() {
        computerWins = 0;
        playerWins = 0;
    }

    public void addComputerWin() {
        computerWins++;
    }
    public void addplayerWin() {
        playerWins++;
    }

    @Override
    public String toString() {
        return "scoreboard: "
            + "\n - Computer wins: " + computerWins 
            + "\n - Player wins: " + playerWins;
    }
}

jwt.js

import { APIGatewayTokenAuthorizerEvent, APIGatewayAuthorizerResult } from "aws-lambda";
import { JWT } from '../lib/jwt'
export async function tokenAuthorizer(event: APIGatewayTokenAuthorizerEvent): Promise<APIGatewayAuthorizerResult> { const {authorizationToken, methodArn } = event; const jwtHandler = new JWT();
let valid = jwtHandler.decodetoken(authorizationToken); if (valid){ valid = await jwtHandler.validatetoken();   }
return jwtHandler.generatePolicy(valid, methodArn); }
  1. 此外,我在访问 API 之前生成一个新令牌。
  2. 来自 API 网关的响应是 500 Internal Server error: message :null。
  3. 还在 API 网关访问日志中添加了“$context.integrationErrorMessage”,但没有任何内容

怎么了?我该如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)