17

I am getting the following error when attempting to run sbt run to run my Scala code:

insecure HTTP request is unsupported 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true), or by using allowInsecureProtocol in repositories file

This is strange because it was working perfectly fine last week and I have changed nothing in the code. I have tried adding ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true) in my build.sbt file and resolver file, installing Java11, deleting my project folder, and completely reclone my code from the repository but nothing is working. I am using Visual Studios but have also tried on IntelliJ and get the same error.

Any advice would be greatly appreciated, as I have changed nothing and now suddenly my code doesn't compile anymore. Further details:

sbt.version = 1.4.0

Scala code runner version 2.12.10

My current built.sbt (please note that I did not have the resolve part added before, when my code was working fine. It was added as an attempt to resolve the issue but did not work):

scalaVersion := "2.12.10"

name := "name"
organization := "org"
version := "1.0"

libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
"org.apache.spark" %% "spark-core" % "3.0.1",
"org.apache.spark" %% "spark-sql" % "3.0.1",
"org.reactivemongo" %% "reactivemongo-bson-api" % "0.20.11",
"org.mongodb.spark" %% "mongo-spark-connector" % "3.0.0",
"com.ibm.db2.jcc" % "db2jcc" % "db2jcc4"
)

resolvers += Resolver.typesafeRepo("releases")

EDIT: I've discovered that this error occurs regardless of project, and even occurs when I simply run sbt by itself.

4
  • 2
    Do you still have SSLHandshakeException after upgrading java? What versions of scala/sbt do you use? Some more information and error details would be helpful. Commented Nov 24, 2020 at 15:22
  • @tentacle thanks for your comments. None of the listed things above made any difference, I still got the same error. Additional version details added to the above. The error occurs after: [info] loading project definition Commented Nov 24, 2020 at 15:44
  • @TomerShetah The issue is that I never needed the resolver part in the first place, and my code was compiling and running completely fine. I have tried and added the resolver resolver part is below anyway: resolvers += Resolver.typesafeRepo("releases") resolvers += Resolver.typesafeIvyRepo("releases") Commented Nov 25, 2020 at 8:16
  • @TomerShetah I tried, this doesn't work unfortunately. Update: I've discovered the error occurs regardless of which project I'm opening, and still occurs by simply entering the SBT environment with the "sbt" command Commented Nov 25, 2020 at 11:25

4 Answers 4

23

Did you try deleting ~/.sbt folder? I had a repositories file in this folder that had HTTP references to the typesafe repo and deleting this folder resolved those sbt HTTP errors.

Sign up to request clarification or add additional context in comments.

2 Comments

rm ~/.sbt/repositories was enough in my case.
I deleted the target folder. I was running clean on builder but was not enough
6

For anyone else using an Intellij setup with this issue, see below

Environment:

  • Scala 2.12.7
  • Intellij Ultimate
  • JVM 11

The issue seems to be a clash between the Intellij IDE SBT plugin ( still on 1.3.2 ) and what seems to be a silent update of sbt.

Running sbt ( version 1.4.3 ) in a terminal instead of using the built in plugin fixed the issue.

Comments

4

As mentioned in repo.typesafe.com, you can add to your sbt:

Resolver.typesafeIvyRepo("releases")

or:

Resolver.typesafeRepo("releases")

Depends whether you are using Ivy or not.

The reason to this warning is the fact that you are using http and not https. From sbt 1.4.0 release notes:

HTTP resolvers require explicit opt-in using .withAllowInsecureProtocol(true)

This is the PR that added it.

5 Comments

OP has made it clear that there's explicit opt-out in the build.
@tentacle, the error message clearly shows that "typesafe-releases" at "http://repo.typesafe.com/typesafe/releases" is part of build.sbt. This is the reason to the warning, and replacing it with Resolver.typesafeIvyRepo("releases") will solve it.
@TomerShetah Thanks for your input, however this did not solve the issue. Additionally I am now getting "Failed to connect with build server, no functionality will work. See logs for more details." after attempting to rebuild build.sbt
@TomerShetah thanks for your suggestions. Please see working solution above by SSam.
resolvers += ("Typesafe repository" at "repo.typesafe.com/typesafe/releases/") .withAllowInsecureProtocol(true)
1

Had to edit ~/.sbt/repositories to use https.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.