This message contains interactive elements.
# general
m
This message contains interactive elements.
b
can you share your code?
m
I have 2 services, let's say
one
and
two
In service
two
ts file I use the following code to reference service `one`:
Copy code
import { OneService } from "../../shared/infra/outputs";
import * as pulumi from "@pulumi/pulumi";

const oneStack = new pulumi.StackReference(`company/two/${config.environment}`); //this line throws the error
const oneStackService = oneStack.getOutput("oneService").apply(s => s as OneService);

... //use extracted value to save in app settings of service two
Service
two
doesn't have any stack references at all. If I use the same code in another service, e.g. service
three
, it works fine
b
does
import { OneService}
include a stack reference?
m
it doesn't
../../shared/infra/outputs
is a file with interfaces
a
just create a wrapper function to get outputs from stack by stack name and output name. then memoize the
new StackReference
also instead of
oneStack.getOutput("oneService").apply(s => s as OneService);
use
StackReference.getOutputDetails
m
thank you for the answer