问题描述
错误:<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<Meta charset="utf-8">
<title>Register</title>
{% load static %}
<link rel="stylesheet" href="{% static './styles/styles.css' %}">
</head>
<!-- <script src="../data/script-clac.js" type="text/javascript"></script> -->
<body class="body1">
<div class="div1">
<h2>Register</h2>
<p class="text">Name</p>
<input type="text" placeholder="Enter your name" id="name">
<p class="text">Username</p>
<input type="text" placeholder="Choose a username" id="username">
<p class="text">Password</p>
<input type="password" placeholder="Choose a password" id="password">
<p id="result"></p>
<input type="checkBox" onclick="myFunction()">Show Password
<button id="btn">Calculate</button>
</div>
</body>
</html>
下面是对应的 serverless.yaml 代码。
我尝试将这两个参数包装成编码的 json 字符串并将其作为单个有效负载字段传递,结果导致相同的错误,但是当有效负载中只有一个普通字段时,此代码部署成功
关于如何传递两个参数的任何建议?
Invalid State Machine DeFinition: 'SCHEMA_VALIDATION_Failed: The value for the field 'Date.$' must be a valid JSONPath at /States/Insert Data Dynamodb/Parameters' (Service: AWsstepFunctions; Status Code: 400; Error Code: InvalidDeFinition;
解决方法
您的 Date.$
属性值为 ${self:custom.dates.year}${self:custom.dates.month}${self:custom.dates.day}
。我们假设:
const dates = {
"year": "2000","month": "01","day": "20"
}
结果将是 Date.$: "20000120"
,它不是有效的 JSON 路径。
JSON Path 需要以 $
符号开头,每一层都被 .
分隔。
你想实现这样的目标吗? $.2000.01.20
?
如您所见,问题不在于传递 2 个参数,而是通过字符串插值为 Date.$
创建的错误字符串 JSON 路径。
一些有用的链接:
https://github.com/json-path/JsonPath
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html