Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend fails to render when a custom provider is added to backend auth configuration. #6276

Closed
Orf1 opened this issue Dec 31, 2024 · 2 comments
Labels
transferred This issue was transferred from another Amplify project

Comments

@Orf1
Copy link

Orf1 commented Dec 31, 2024

Environment information

System:
  OS: macOS 15.1.1
  CPU: (16) arm64 Apple M3 Max
  Memory: 3.17 GB / 48.00 GB
  Shell: /bin/zsh
Binaries:
  Node: undefined - undefined
  Yarn: 1.22.22 - ~/Library/Application Support/JetBrains/WebStorm2024.2/node/versions/23.1.0/bin/yarn
  npm: 10.9.1 - ~/Library/Application Support/JetBrains/WebStorm2024.2/node/versions/23.1.0/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/backend: 1.0.0
  @aws-amplify/backend-cli: 1.0.1
  aws-amplify: 6.2.0
  aws-cdk: 2.140.0
  aws-cdk-lib: 2.140.0
  typescript: 5.4.5
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Describe the bug

We're working on implementing Microsoft EntraID using SAML.

When the SAMLprovider is added to the auth configuration and deployed, Sign in with Microsoft works great locally using vite.

Unfortunately, the hosted deployment at amplifyapp.com is completely blank.

There are no errors present in the console or network tab. It's just completely empty.

When we remove the SAML portion of the auth configuration and push again. The page renders perfectly fine. (without working SAML obviously)

It's important to re-iterate that it works perfectly fine when running on localhost. Blank only when it's accessed via the amplifyapp.com url.

There are no errors in the deployment logs, and both the working and non working deployments have identical logs.

The issue is present on both Chrome & Safari after clearing cache, other browsers haven't been tested.

Without SAML
without_saml

With SAML
with_saml

Reproduction steps

Add an SAML provider to the Auth resource.ts

Auth resource.ts

import {defineAuth, secret} from '@aws-amplify/backend';
import {preSignUp} from "./pre-sign-up/resource";

export const auth = defineAuth({
  loginWith: {
    email: true,
    externalProviders: {
      google: {
        clientId: secret('GOOGLE_CLIENT_ID'),
        clientSecret: secret('GOOGLE_CLIENT_SECRET'),
        scopes: ['email'],
      },
      saml: {
        name: "MicrosoftEntraID",
        metadata: {
          metadataType: "URL",
          metadataContent: "...",
        },
        attributeMapping: {
          email: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
        },
      },
      callbackUrls: [
        ...
      ],
      logoutUrls: [
        ...
      ]
    }
  },
  triggers: {
    preSignUp,
  },
  access: (allow) => [
    allow.resource(preSignUp).to(["manageUsers"]),
  ],
});

App.tsx

function App() {
  const [theme] = useMode();
  
  global.navigator = {
    userAgent: 'node',
  }

  return (
    <ThemeProvider theme={theme}>
      <CssBaseline/>
      <Authenticator
        hideSignUp={true}
        components={{
          Header: CustomHeader,
          Footer: CustomFooter,
        }}
      >
        ...
      </Authenticator>
    </ThemeProvider>
  );
}

export default App;
@Orf1 Orf1 added the pending-triage Issue is pending triage label Dec 31, 2024
@ykethan
Copy link
Member

ykethan commented Jan 2, 2025

Hey,👋 thanks for raising this! I'm going to transfer this over to our Amplify UI repository for better assistance on the authenticator component.

@ykethan ykethan transferred this issue from aws-amplify/amplify-backend Jan 2, 2025
@ykethan ykethan added the transferred This issue was transferred from another Amplify project label Jan 2, 2025
@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Jan 2, 2025
@Orf1
Copy link
Author

Orf1 commented Jan 3, 2025

This issue was fixed by updating to the latest version.
https://docs.amplify.aws/gen1/react/prev/build-a-backend/troubleshooting/upgrade-amplify-packages/

@Orf1 Orf1 closed this as completed Jan 3, 2025
@github-actions github-actions bot removed pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify UI maintainer labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transferred This issue was transferred from another Amplify project
Projects
None yet
Development

No branches or pull requests

2 participants