@@ -14,9 +14,9 @@ import {
1414import { Provider } from 'aws-cdk-lib/custom-resources' ;
1515import { Construct } from 'constructs' ;
1616import { CfnBranch } from 'aws-cdk-lib/aws-amplify' ;
17- import { IApp , Platform } from './app' ;
17+ import { App , IApp , Platform } from './app' ;
1818import { BasicAuth } from './basic-auth' ;
19- import { renderEnvironmentVariables } from './utils' ;
19+ import { renderEnvironmentVariables , isServerSideRendered } from './utils' ;
2020import { AssetDeploymentIsCompleteFunction , AssetDeploymentOnEventFunction } from '../custom-resource-handlers/dist/aws-amplify-alpha/asset-deployment-provider.generated' ;
2121import { addConstructMetadata , MethodMetadata } from 'aws-cdk-lib/core/lib/metadata-resource' ;
2222import { propertyInjectable } from 'aws-cdk-lib/core/lib/prop-injectable' ;
@@ -194,8 +194,11 @@ export class Branch extends Resource implements IBranch {
194194 // Enhanced CDK Analytics Telemetry
195195 addConstructMetadata ( this , props ) ;
196196
197- const platform = props . app . platform ;
198- const isSSR = platform === Platform . WEB_COMPUTE || platform === Platform . WEB_DYNAMIC ;
197+ let platform : Platform | undefined ;
198+ if ( props . app instanceof App ) {
199+ platform = props . app . platform ;
200+ }
201+ const isSSR = isServerSideRendered ( platform ) ;
199202
200203 if ( props . computeRole && ! isSSR ) {
201204 throw new ValidationError ( '`computeRole` can only be specified for branches of apps with `Platform.WEB_COMPUTE` or `Platform.WEB_DYNAMIC`.' , this ) ;
0 commit comments