nisyuu
@nisyuu

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

SendRawEmailCommandでrawMessageを入れているのにValue null at 'rawMessage'と言われる

AWS LambdaのNodejs18環境で、@aws-sdk/client-sesをインポートしメールの送信をしようとしたところ設定しているはずの値がないと言われました。

ドキュメント通りに実装しているはずなのですが、指定の仕方に誤りなどがあれば教えていただきたいです。

コード

import { SESClient, SendRawEmailCommand } from "@aws-sdk/client-ses"

const params = {
  source: 'メールアドレス',
  rawMessage: {
    data: 'メールデータ'
  },
}
  
const command = new SendRawEmailCommand(params)
const client = new SESClient();
await client.send(command)

エラーメッセージ

{
  "errorType": "ValidationError",
  "errorMessage": "1 validation error detected: Value null at 'rawMessage' failed to satisfy constraint: Member must not be null",
  "trace": [
    "ValidationError: 1 validation error detected: Value null at 'rawMessage' failed to satisfy constraint: Member must not be null",
    "    at throwDefaultError (/var/runtime/node_modules/@aws-sdk/smithy-client/dist-cjs/default-error-handler.js:8:22)",
    "    at deserializeAws_querySendRawEmailCommandError (/var/runtime/node_modules/@aws-sdk/client-ses/dist-cjs/protocols/Aws_query.js:2609:51)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
    "    at async /var/runtime/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24",
    "    at async /var/runtime/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:13:20",
    "    at async StandardRetryStrategy.retry (/var/runtime/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)",
    "    at async /var/runtime/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22",
    "    at async Runtime.handler (file:///var/task/index.mjs:96:3)"
  ]
}
0

1Answer

プロパティのrawMessageやDataなどSESのパラメータ名は大文字始まりです。

const params = {
  Source: 'メールアドレス',
  RawMessage: {
    Data: 'メールデータ'
  },
}
0Like

Your answer might help someone💌