我也在模拟后得到空指针异常.请找到我的项目结构.
//this is the pet interface
public interface Pet{
}
// An implementation of Pet
public class Dog extends Pet{
int id,
int petName;
}
// This is the Service Interface
public interface PetService {
List<Pet> listPets();
}
// a client code using the PetService to list Pets
public class App {
PetService petService;
public void listPets() {
// TODO Auto-generated method stub
List<Pet> listPets = petService.listPets();
for (Pet pet : listPets) {
System.out.println(pet);
}
}
}
// This is …Run Code Online (Sandbox Code Playgroud) 以下是我的代码,它从 Amazon Fargate 服务上运行的服务之一向 API 端点发出 Http Get 请求。该 API 由 Amazon API 网关和 Lambda 提供支持。此外,这是在 VPC 中使用的私有 api,我还设置了 apigateway VPC 端点以实现相同目的。我只收到过一次此错误。后续对 API 的所有调用均成功。
我怀疑 lambda 不热,导致超时。我将尝试为 axios 代码设置超时。欢迎任何建议
async getItems(): Promise < any > {
try {
let url = `https://vpce-[id].execute-api.ap-southeast-2.vpce.amazonaws.com/prod/items`
const response = await axios.get(url, {
headers: {
'Authorization': `Bearer ${token}`,
'x-apigw-api-id': `[api-id]`
}
});
return response.data;
} catch(error) {
console.log(error);
throw error;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 S3 存储桶策略中使用 IAM 全局条件键aws:PrincipalOrgPaths,但我不断收到“拒绝访问”错误。我可以很好地使用密钥aws:PrincipalOrgID。下面的消毒桶策略是我正在尝试使用的。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MyOrgOnly",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::thebucketofmydreams",
"arn:aws:s3:::thebucketofmydreams/*"
],
"Condition": {
"ForAnyValue:StringLike": {
"aws:PrincipalOrgPaths": "o-funny/r-stuff/ou-path"
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)