re: bun support – looking at the failures in <http...
# contribute
b
re: bun support – looking at the failures in https://github.com/pulumi/pulumi/pull/20160 (of which I have also experienced locally); specifically it seems like outputs from one resource fail to propagate to inputs of another resource. i think it's located in this code block:
Copy code
function resolveProperties(res, resolvers, t, name, allProps, deps, err, keepUnknowns) {
    // If there is an error, just reject everything.
    if (err) {
        for (const k of Object.keys(resolvers)) {
            const resolve = resolvers[k];
            resolve(undefined, true, false, [], err);
        }
        return;
    }
where this code:
Copy code
secret = new aws.secretsmanager.Secret(
  `repo-${key}-secret`,
  {
    name: `ecr-pullthroughcache/${key}`,
    secretString: JSON.stringify(repo.auth),
  },
);
new aws.ecr.PullThroughCacheRule(
  `repo-${key}-rule`
  {
    credentialArn: secret.awsId,
    upstreamRegistryUrl: repo.url,
    ecrRepositoryPrefix: key,
  },
);
results in the output of:
Copy code
error: creating resource: creating resource (await): operation CREATE failed with "InvalidRequest": The specified upstream registry requires authentication. Specify a valid Secrets Manager ARN containing the upstream registry credentials and try again. (Service: Ecr, Status Code: 400, Request ID: ...) (SDK Attempt Count: 1)
and the debug logs show: > error: failed to register new resource ... [aws-nativeecr...]: Resource monitor is terminating and the resource failing to create because the input is
<nil>
instead of the correct value. i am uncertain where to trace the rest of this, any guidance would be appreciated 🙂
narrowing:
Copy code
// We treat properties with undefined values as if they do not exist.
            const dependentResources = new Set();
            const v = await serializeProperty(`${label}.${k}`, props[k], dependentResources, opts);
            if (v === undefined && props[k] !== undefined) {
              console.log(`failed to serialize ${label}.${k}`);
            }
^^ the above does nothing in
node
and outputs
failed to serialize...
in
bun
. specifically in
bun
the output is undefined and in
node
the output is a uuid
node
classifies the output as
UNKNOWN
,
bun
simply returns
undefined
node
has
ResourceImpl
that includes
Unknown { __pulumiUnknown: true }
objects,
bun
does not
execution differences traced to
transferProperties
where
resolvers[k] = (v, isKnown, isSecret, deps = [], err) => {
has
v
with
Unknown
instances in
node
but not in
bun
Copy code
resolvers[k] = (v, isKnown, isSecret, deps = [], err) => {
          if (v && typeof v === 'object' && ('__pulumiUnknown' in v)) {
            console.log('UNKNOWN VALUE', label);
          }
produces output in
node
but no output in
bun
Copy code
isKnown = Promise.all([isKnown, promise]).then(([known, val]) => {
known
is
true
in
bun
and
false
in
node
Copy code
for (const k of Object.keys(resolvers)) {
        if (!allProps.hasOwnProperty(k)) {
            const resolve = resolvers[k];
            if (!settings_1.isDryRun && keepUnknowns) {
                resolve(output_1.unknown, true, false);
            }
            else {
                console.log(!settings_1.isDryRun() && !keepUnknowns)
                resolve(undefined, !settings_1.isDryRun() && !keepUnknowns, false);
            }
        }
    }
the
!settings_1.isDryRun() && !keepUnknowns
block is
true
in
bun
and
false
in
node
specifically
settings_1.isDryRun()
Copy code
dryRun: `${process.env[nodeEnvKeys.dryRun]}` === "true",
solves this problem
for some ungodly reason the result of
process.env[nodeEnvKeys.dryRun]
is not a string?
Copy code
function addToEnvIfDefined(key, value) {
    if (value) {
        process.env[key] = `${value}`;
    }
}
^ is a better fix
resource monitor shut down while waiting on step's done channel
this still fails:
Copy code
resp = await debuggable_1.debuggablePromise(new Promise((resolve, reject) => monitor.registerResource(req, (rpcErr, innerResponse) => {
                        if (rpcErr) {
                            err = rpcErr;