This is a stupid question - in the guide you say t...
# help
d
This is a stupid question - in the guide you say to do this:
Copy code
export default class ApiStack extends sst.Stack {
  api;

  constructor(scope, id, props) {
    super(scope, id, props);
    ...
Why do we expose api? Is there any requirement of SST for us to do that?
t
only if you're passing it to another stack to reference
d
we need it because of this :
Copy code
const apiStack = new ApiStack(app, 'api', {...});
  const authStack = new AuthStack(app, 'auth', {
    api: apiStack.api,
    uploadsBucket: storageStack.uploadsBucket,
  });
?
t
yep sounds right
d
Hum I removed the reference but it still works and detects no build change
f
Can I see how you are using the api inside the AuthStack?
d
Copy code
export default class AuthStack extends sst.Stack {
  auth;

  constructor(scope, id, props) {
    super(scope, id, props);

    const { api, uploadsBucket } = props;

    this.auth = new sst.Auth(this, 'Auth', { ... });

    this.auth.attachPermissionsForAuthUsers([
      api,
      // ...
    ]);
    // ...
  }
}