Skip to content

Commit 5cc82c3

Browse files
committed
debug state fetch
1 parent f524060 commit 5cc82c3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/services/GithubService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export class GithubService {
101101
`Inferring identity (auth: ${auth} sha: ${tokenSha} owner: ${owner}, repo: ${repo}, workspace: ${workspace})`,
102102
);
103103

104+
// TODO Expire stored identities
104105
const storedIdentity = await this.identityModel.model.get(
105106
IdentityModel.prefix('pk', tokenSha),
106107
IdentityModel.prefix('sk'),
@@ -110,7 +111,7 @@ export class GithubService {
110111
// Terraform planfiles contain backend configurations from plan operations
111112
// Return the previously known identy from the plan operation
112113
console.log(`Found previously known identity (sha: ${tokenSha})`);
113-
return storedIdentity.attrs;
114+
return { ...storedIdentity.attrs, workspace: workspace || 'default' };
114115
}
115116

116117
const octokit = new Octokit({ auth });

src/services/StateService.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,24 @@ export class StateService {
8383
};
8484

8585
public getState = async (identity: IdentityWithToken): Promise<any> => {
86+
console.log(`!!! pk search`, StateModel.prefix('pk', identity.ownerId));
87+
console.log(
88+
`!!! sk search`,
89+
StateModel.prefix('sk', `${identity.repoId}_${identity.workspace}`),
90+
);
91+
8692
const state = await this.stateModel.model.get(
8793
StateModel.prefix('pk', identity.ownerId),
8894
StateModel.prefix('sk', `${identity.repoId}_${identity.workspace}`),
8995
);
9096

9197
if (!state) {
98+
console.warn(
99+
`State not found (pk: ${StateModel.prefix('pk', identity.ownerId)} sk: ${StateModel.prefix(
100+
'sk',
101+
`${identity.repoId}_${identity.workspace}`,
102+
)})`,
103+
);
92104
return null;
93105
}
94106

@@ -104,6 +116,7 @@ export class StateService {
104116
const { Body } = download;
105117

106118
if (!Body) {
119+
console.warn(`State not found in S3`);
107120
return null;
108121
}
109122

0 commit comments

Comments
 (0)