FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Duplicating Application Doesn't Work if SAML is Configured

    Scheduled Pinned Locked Moved
    Q&A
    0
    2
    275
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      williamw
      last edited by

      FusionAuth 1.30.0

      I created an application for dev and testing. I went to duplicate it so I can have a production version and a dev version. When attempting to save the new Application (changing only the name field), the UI displays this error:

      FusionAuth encountered an unexpected error. Please review the troubleshooting guide found in the documentation for assistance and the available support channels.

      I checked the logs and this seems to be the error:

      2021-08-24 9:17:09.736 PM ERROR io.fusionauth.app.primeframework.error.ExceptionExceptionHandler - An unhandled exception was thrown
      org.apache.ibatis.exceptions.PersistenceException: 
      ### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "applications_uk_2"
        Detail: Key (samlv2_issuer, tenants_id)=(XXX.com, 6165e858-303b-a811-179f-25281f4123e1) already exists.
      ### The error may exist in io/fusionauth/api/domain/ApplicationMapper.xml
      ### The error may involve defaultParameterMap
      ### The error occurred while setting parameters
      ### SQL: INSERT INTO       applications(                    id,                    active,                    data,                    email_update_email_templates_id,                    email_verification_email_templates_id,                    email_verified_email_templates_id,                    forgot_password_email_templates_id,                    name,                    access_token_signing_keys_id,                    forms_id,                    id_token_signing_keys_id,                    insert_instant,                    last_update_instant,                    login_id_in_use_on_create_email_templates_id,                    login_id_in_use_on_update_email_templates_id,                    login_new_device_email_templates_id,                    login_suspicious_email_templates_id,                    multi_factor_email_message_templates_id,                    multi_factor_sms_message_templates_id,                    passwordless_email_templates_id,                    password_reset_success_email_templates_id,                    password_update_email_templates_id,                    samlv2_issuer,                    access_token_populate_lambdas_id,                    id_token_populate_lambdas_id,                    admin_registration_forms_id,                    self_service_user_forms_id,                    samlv2_keys_id,                    samlv2_default_verification_keys_id,                    samlv2_logout_default_verification_keys_id,                    samlv2_logout_keys_id,                    samlv2_single_logout_keys_id,                    samlv2_populate_lambdas_id,                    set_password_email_templates_id,                    tenants_id,                    themes_id,                    two_factor_method_add_email_templates_id,                    two_factor_method_remove_email_templates_id,                    ui_ip_access_control_lists_id,                    verification_email_templates_id)       VALUES (?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?,               ?)
      ### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "applications_uk_2"
        Detail: Key (samlv2_issuer, tenants_id)=(XXX.com, 6165e858-303b-a811-179f-25281f4123e1) already exists.
      	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:196)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181)
      ....
      

      SAML is actually disabled for both applications, but in the original application I had entered a value into the Issuer field. This causes the duplicate application saving to fail even though SAML is disabled for both applications.

      I Enabled SAML, deleted the Issuer from the new application, then disabled it again since I don't need it yet, and the new application saved fine after that.

      So I guess this is half bug report and half info for anyone who runs into this issue.

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        Thanks for reporting this. The workaround is to remove the configuration from the SAML provider. I also tested it out and when SAML is enabled and you try to duplicate the app, you are presented with an error message.

        I filed an issue about this: https://github.com/FusionAuth/fusionauth-issues/issues/1366

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • First post
          Last post