The membership is read by its subject
The runtime asked the assignments stream's root for the last message by subject in the body, and the mesh grants a module's account only the subject-addressed form of the direct get — the server refused every read (Publish Violation on $JS.API.DIRECT.GET.ASSIGNMENTS for every module on the new runtime), so every runtime kept the derived shape. The address is now the stream then the subject, nothing in the body, which is the one address the account has.
This commit is contained in:
+5
-2
@@ -161,8 +161,11 @@ export async function connectNats(
|
||||
const subjectOfMine = node ? membershipSubject(node, self) : "";
|
||||
if (subjectOfMine) {
|
||||
try {
|
||||
const got = await conn.request(`$JS.API.DIRECT.GET.${ASSIGNMENTS_STREAM}`,
|
||||
sc.encode(JSON.stringify({ last_by_subj: subjectOfMine })), { timeout: 5_000 });
|
||||
// The subject-addressed form of a direct get — the stream, then the subject, nothing in
|
||||
// the body — because that is the one address the mesh grants this account on the
|
||||
// stream's API; the body form asks the stream's root, which it may not.
|
||||
const got = await conn.request(`$JS.API.DIRECT.GET.${ASSIGNMENTS_STREAM}.${subjectOfMine}`,
|
||||
new Uint8Array(0), { timeout: 5_000 });
|
||||
const status = got.headers?.code ?? 0;
|
||||
if (status === 0 && got.data.length > 0) {
|
||||
issued = JSON.parse(sc.decode(got.data)) as Membership;
|
||||
|
||||
Reference in New Issue
Block a user