Closed bahaa-mp closed 3 months ago
Hi @bahaa-mp ,
Thanks for opening this issue. I'm not entirely sure why this is happening. I have inspected the serialized request, and don't see anything out of the ordinary - no serialization issues, no values are omitted. I even tried reproducing this with the Go SDK and the CLI and witnessed the same issue.
CLI:
$ aws pinpoint update-journey \
--application-id "REDACTED" \
--journey-id "REDACTED" \
--write-journey-request '{
"Name": "REDACTED",
"State": "ACTIVE",
"Schedule": {
"StartTime": "2023-10-03T03:15:00Z",
"EndTime": "2023-10-10T02:00:00Z",
"Timezone": "UTC+09"
},
"StartActivity": "firstActivity",
"StartCondition": {
"SegmentStartCondition": {
"SegmentId": "REDACTED"
}
}
}'
An error occurred (BadRequestException) when calling the UpdateJourney operation: Journey validation failed, Start time 2023-10-03T03:15:00Z doesn't have the same offset as the journey's schedule offset: UTC+09
JS SDK:
import { PinpointClient, UpdateJourneyCommand, CreateJourneyCommand } from "@aws-sdk/client-pinpoint";
const ppclient = new PinpointClient({ region: "us-east-1" });
let startTime = new Date("2023-10-03T03:15:00+09:00");
let endTime = new Date("2023-10-10T02:00:00+09:00");
async function run() {
try {
const res = await ppclient.send(
new CreateJourneyCommand({
ApplicationId: "REDACTED",
WriteJourneyRequest: {
Name: "foo3",
Activities: {
firstActivity: {
SMS: {
MessageConfig: {
MessageType: "TRANSACTIONAL",
SenderId: "REDACTED",
},
},
StartCondition: {
SegmentStartCondition: {
SegmentId: "REDACTED",
},
},
},
},
StartActivity: "firstActivity",
Limits: {},
QuietTime: {},
Schedule: {
StartTime: new Date("2023-09-03T03:15:00Z"),
EndTime: new Date("2023-09-10T02:00:00Z"),
Timezone: "UTC+09",
},
State: "DRAFT",
},
})
);
console.log(res);
// update that same Journey
const command = new UpdateJourneyCommand({
JourneyId: res.JourneyResponse.Id,
ApplicationId: res.JourneyResponse.ApplicationId,
WriteJourneyRequest:{
State: "ACTIVE",
Schedule: {
StartTime: startTime,
EndTime: endTime,
Timezone: "UTC+09",
},
Name: "foo3",
StartActivity: "firstActivity",
StartCondition: {
SegmentStartCondition: {
SegmentId: "REDACTED"
}
},
}
});
const updateResponse = await ppclient.send(command);
console.log(updateResponse)
} catch (error) {
console.log(error);
}
}
run();
// BadRequestException: Journey validation failed, Start time 2023-10-02T18:15:00Z doesn't have the same offset as the journey's schedule offset: UTC+09
I even implemented a logging middleware to capture the serialized request to make sure the UTC offset is accounted for in the update, which clearly is:
before sign: HttpRequest {
method: 'PUT',
hostname: 'pinpoint.us-east-1.amazonaws.com',
port: undefined,
query: {},
headers: { 'content-type': 'application/json', 'content-length': '257' },
body: '{"Name":"REDACTED","Schedule":{"EndTime":"2023-10-09T17:00:00Z","StartTime":"2023-10-02T18:15:00Z","Timezone":"UTC+09"},"StartActivity":"firstActivity","StartCondition":{"SegmentStartCondition":{"SegmentId":"REDACTED"}},"State":"ACTIVE"}',
protocol: 'https:',
path: '/v1/apps/REDACTED/journeys/REDACTED',
username: undefined,
password: undefined,
fragment: undefined
}
This might be a bug with the Pinpoint Service itself, or a behavior that is not clearly documented. Unfortunately there is not much I can do to unblock you here.
I have created an internal ticket with the pinpoint service team. You can try to open an additional one through your AWS console and ask them to refer to the one I have opened myself :P98955945
.
Apologies for the inconveniences, Ran~
Hi Ran,
Thank you for the follow-up and the detailed investigation. Please keep us posted with the result of your ticket.
Unfortunately, there are other issues I face sometimes like when the Journey created in the console has open hours in the schedule for some days and the other days are empty (default no open hours). Then, the getJourneyCommand does not work and returns an error that cannot format dates. But the REST API / or the SDK v2 work.
Also, I could not set the estimation of the timezone per endpoint phone number. I double-checked to use a local time = true. The request returns success but that has no effect in the console. In SDK v2, I get the error TimezoneEstimationMethods is not an expected key!
Thank you again
@bahaa-mp Good afternoon. We have an update from the service team that the fix is already deployed for this issue. Could you please verify the same at your end and confirm if this issue is good to be closed.
Thanks, Ashish
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Checkboxes for prior research
Describe the bug
When I try to update a journey in pinpoint in sdk v3 to active state. like this
I always get an error like this
It is clear that whatever we set as a value to StartTime or EndTime would not solve the issue as the _.toISOString() is executed internally and always would result in an ISO string without time offset.
SDK version number
@aws-sdk/client-pinpoint
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
lambda environment node Node.js 18.x
Reproduction Steps
Use the code mentioned in the description
Observed Behavior
I could not set a journey as an active with a timezone
Expected Behavior
I should be able to set a journey as an active with a timezone
Possible Solution
No response
Additional Information/Context
No response