Skip to content

Cyclic reference involving object WebIdentityTokenFileCredentialsProvider #18423

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

Open
ricardoitv opened this issue Aug 18, 2023 · 1 comment
Open
Labels
itype:bug stat:needs minimization Needs a self contained minimization

Comments

@ricardoitv
Copy link

ricardoitv commented Aug 18, 2023

Compiler version

3.3.0 but I've also tried with 3.2.0, 3.1.0 and 3.0.0.
I couldn't reproduce it with Scala 2.13.11.

Minimized code

import software.amazon.awssdk.auth.credentials.WebIdentityTokenFileCredentialsProvider
import java.nio.file.Paths

object Main extends App {
  WebIdentityTokenFileCredentialsProvider.builder
    .roleArn("dummy")
    .roleSessionName("Dummy")
    .webIdentityTokenFile(Paths.get("."))
    .build
}

SBT dependency:

libraryDependencies ++= List("software.amazon.awssdk" % "sts" % "2.20.69")

Repo with all the code: https://github.com/ricardoitv/cyclic-reference-involving-object/tree/without-sbt-native-packager

Output

exception caught when loading trait Builder: Cyclic reference involving object WebIdentityTokenFileCredentialsProvider
exception caught when loading module class WebIdentityTokenFileCredentialsProvider$: Cyclic reference involving object WebIdentityTokenFileCredentialsProvider

Expectation

The error is reproducible by running sbt doc but I've bumped into it when running sbt stage (sbt-native-packager version 1.9.16).

It looks similar to this issue: #15288

@ricardoitv ricardoitv added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 18, 2023
@ricardoitv
Copy link
Author

Someone at my company was experimenting with the code and they found that if we extract WebIdentityTokenFileCredentialsProvider.builder into a variable, then everything works again.

So this works:

import software.amazon.awssdk.auth.credentials.WebIdentityTokenFileCredentialsProvider
import java.nio.file.Paths

object Main extends App {
  val builder = WebIdentityTokenFileCredentialsProvider.builder
  builder
    .roleArn("dummy")
    .roleSessionName("Dummy")
    .webIdentityTokenFile(Paths.get("."))
    .build
}

@mbovel mbovel added stat:needs minimization Needs a self contained minimization and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug stat:needs minimization Needs a self contained minimization
Projects
None yet
Development

No branches or pull requests

2 participants