Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ankit Bhatt
    @appdirect-ankitbhatt
    it only measures the coverage for Generated Scala Classes
    Dan Ellis
    @danellis

    If my template is compiled to

    object privacyPolicy
    extends _root_.play.twirl.api.BaseScalaTemplate[play.twirl.api.HtmlFormat.Appendable,_root_.play.twirl.api.Format[play.twirl.api.HtmlFormat.Appendable]](play.twirl.api.HtmlFormat) 
    with _root_.play.twirl.api.Template2[RequestHeader,User,play.twirl.api.HtmlFormat.Appendable]

    why can't I pass it to a function that takes Template2[RequestHeader, User, HtmlFormat.Appendable]?

    It's complaining that I'm passing a privacyPolicy.type, but surely privacyPolicy.type is_a Template2[...]
    Dheeraj Karande 🇮🇳
    @dheerajkarande_twitter
    can we add properties to global conf programmatically? i am able to add it in conf but its returning new one, I just want to replace new conf with the existing one. Can we do that?
    Dan Ellis
    @danellis

    Okay, I kind of fixed it with a view bound, but the routes compiler still gives me an "end of input expected" error for this line:

    GET     /privacy                    controllers.ViewController.view(views.html.pages.privacyPolicy)

    Why is it expecting end of input?

    Dan Ellis
    @danellis
    Looks like the only way to pass a hardcoded value is to specify it as the default of a query string parameter 😕
    N.S. Cutler
    @godenji

    @sherpal

    But concretely, are there (small, isolated) things that we (I) could do to contribute? I'm assuming someone out there analised the necessary step to go to Scala 3 (?)

    Well, scala 2 macros for a start:
    grep -R " macro " core/

    and then abstract type projections and other removed features; those cover the part that the framework controls. Next are the myriad dependencies and whether or not they contain scala 2 macros.

    Not sure how deep the rabbit hole is, but deep enough for nobody to have bothered doing anything yet (macro migration is especially hairy, scala 3 macros may be better than scala 2's, but navigating the former and discovering the new ways is non-trivial)

    Antoine Doeraene
    @sherpal
    thanks for that! Unfortunately I have never touched macros in my life, and this does not seem like a good place to start :(
    This compared to a project like Quill, where essentially the entire code base is derived from scala 2 macros.
    Maksym Vorobey
    @Max161
    If you were to use the hexagonal architecture, known also as Ports & Adapters if your web server was a Play framework would you put an Akka Actors layer between the controller layer and the application one? For example, as represented here: https://ibb.co/N3vGDb4
    Or it's only adding complexity to the application? In such a situation the controller would send a message to an Actor, that would execute a particular use case...
    Gerald Mixa
    @gmixa
    @Max161 I do not see why this would be of use for a brand new application on a single server. If you have an application that expects heavy load I would use this design to distribute the backend on several machines. In this case this could be an option. But as I do not know your use case I can’t justify if I would start with such a design from scratch. I rather would start with a simpler design. Of course my design would include own modules for db access, backend access etc. I would start with a simple solution for a single server and pick a design that’s open for extending it with an actor layer if it will be needed!
    Maksym Vorobey
    @Max161
    @gmixa The project is going to manage IoT devices, so the load would be directly proportional to the number of devices. When I entered the project the controllers was redirecting the request messages to static 1st level actors, without any hierarchy, that were responsible of managing the work. I'm trying to change the overall architecture of this application so that it's easy to manage in the future.
    Gerald Mixa
    @gmixa
    I never have done anything with IoT and missed that information. If the system load scales with the number of deployed devices you might be able to scale your backend that way too. In theory that looks suitable to me but I miss experience in this area. If you expect heavy growth I also would think about the Frontend/presentation layer and how to scale this too.
    Ian Wood
    @TheOnlyIanWood
    Hi, I am going through the documentation (https://www.playframework.com/documentation/2.8.x/ImplementingHelloWorld) and notice some mistakes that I can fix. How do I go about? Its just minor things but they did throw me.
    Antoine Doeraene
    @sherpal
    You can directly make a pr to the repo. I believe there is a link for that on each page of the docs, probably at the bottom
    Ian Wood
    @TheOnlyIanWood
    Great, thanks.
    amahonee
    @amahonee
    Hi everyone, today I got an alert for CVE-2021-23339. From reading, Akka seems to have fixed the vulnerability in akka-http-core versions v10.1.14 and v10.2.4. My question is what versions of akka http is used in play 2.7/ 2.8 and where can I find that information for future reference?
    Thanks in advance for any help!
    jxtps
    @jxtps
    Play 2.8.7 is on v10.1.13, and play 2.8.8 is on v10.1.14 (based on what IntelliJ is showing under External Libraries in the project browser).
    Nikitha963
    @Nikitha963

    Hi All,

    [error] /home/nikitha/Documents/Polaris/polaris-web/polaris-upgrade-sbt-1.3.0/modules/core/app/polaris/core/views/errors/unauthorized.scala.html:9: not found: value main
    [error] @main("") { }
    [error] ^
    [error] /home/nikitha/Documents/Polaris/polaris-web/polaris-upgrade-sbt-1.3.0/modules/core/app/polaris/core/views/login.scala.html:3: not found: type CoreModule
    [error] @coreModule = @{play.Play.application().plugin(classOf[CoreModule])}<!DOCTYPE html>
    [error] ^
    [error] /home/nikitha/Documents/Polaris/polaris-web/polaris-upgrade-sbt-1.3.0/modules/core/app/polaris/core/views/main.scala.html:3: not found: value User
    [error] @user = @{User.current()}
    [error] ^
    [error] /home/nikitha/Documents/Polaris/polaris-web/polaris-upgrade-sbt-1.3.0/modules/core/app/polaris/core/views/users/index.scala.html:1: not found: value page
    [error] @page(Messages("polaris.core.users")) {
    [error] ^
    [error] four errors found
    [error] (core/compile:compileIncremental) Compilation failed

    I am getting the above compilation issues. I am upgrading play from 2.2.6 to 2.4.0 version. I migrated from plugins to modules as per the document :https://www.playframework.com/documentation/2.4.x/PluginsToModules

    Altern Egro
    @alternegro
    Hello, is there any reason why I can reliably connect to a remote database when I run a play app in dev mode, but running the console using the same configuration often times yields a db timeout?
    12 replies
    amine.chikhaoui
    @amine.chikhaoui:matrix.org
    [m]

    Hi everyone, cross posting a question from akka/akka channel

    Hi everybody, I'm experimenting with Akka + Play framework for the first time and have some questions. For example say I have a web service endpoint /doAction which I want to use in a hybrid mode in terms of consistency. It would do a write to a database + send a message to a Kafka topic for consumption by downstream systems. The request from the client would return as soon as the database write is done and the rest is eventually consistent. My confusion is how to make sure that this process is atomic i.e what if the app crashes halfway through (between the database update and sending the kafka message)

    Raul Rodriguez
    @raul782
    https://gitter.im/playframework/playframework/archives/2015/08/13?at=55cc4ca23d8917890c15cdd7 what is the right fix, I have a legacy project running 2.3.10, I'm looking to upgrade scala and play, but It seems there is no workaround? as I upgrade scala first, scala/bug#8761, It seems this is still an open bug?
    jxtps
    @jxtps
    I don’t think it’s possible to ensure atomicity between a database write and sending a kafka message under any circumstance? I guess you could do the db write in a transaction and not complete it until the kafka message has been sent, but then you don’t get the early return you’re looking for.
    (The kafka send is unlikely to be truly atomic so you will likely have scenarios where the message was indeed sent but your code thinks it wasn’t and then you have a message on the wire but no update in your db…)
    I would abandon all hope for true atomicity and instead have an additional piece of state in the db: kafkaSendMessageStatus (or whatever). So write the db w kafka status = not sent, return to the client, then send the kafka message and update to kafka status = sent, with exception handling etc setting kafka status = failed. Then at least you have visibility into what (likely) happened.
    Matt Dziuban
    @mrdziuban

    hey all, I'm occasionally seeing this error in production and trying to figure out what it means

    Sink.asPublisher(fanout = false) only supports one subscriber (which is allowed, see reactive-streams specification, rule 1.12)"

    does anyone have any ideas or could point me in the right direction?

    Nikitha963
    @Nikitha963

    Hi All,

    templatesImport ++= Seq(
            "views.html.helper._",
            "polaris._",
            "polaris.api._",
            "polaris.models._",
            "polaris.core._",
            "polaris.core.util._",
            "polaris.core.views.html._"
    )

    I have above syntax in multi project module in build.sbt file and getting below error:

    build.sbt:29: error: not found: value templatesImport
    templatesImport += Seq(
    ^

    Kindly help me here . I tried to write like :

    TwirlKeys.templateImports ++= Seq(
            "views.html.helper._",
            "polaris._",
            "polaris.api._",
            "polaris.models._",
            "polaris.core._",
            "polaris.core.util._",
            "polaris.core.views.html._"
    )

    Then also I am facing the issue like below :

    
    [error] References to undefined settings: 
    [error] 
    [error]   pbxAppPhonebook/*:twirlTemplateImports from pbxAppPhonebook/*:twirlTemplateImports (/home/nikitha/Documents/Polaris/polaris_sbt_play_scala_upgrade_version/polaris-upgrade-sbt-1.3.0/modules/pbx-app-phonebook/build.sbt:20)
    [error]
    Nikitha963
    @Nikitha963
    hello

    Hi All,

    templatesImport ++= Seq(
            "views.html.helper._",
            "polaris._",
            "polaris.api._",
            "polaris.models._",
            "polaris.core._",
            "polaris.core.util._",
            "polaris.core.views.html._"
    )

    I have above syntax in multi project module in build.sbt file and getting below error:

    build.sbt:29: error: not found: value templatesImport
    templatesImport += Seq(
    ^

    Kindly help me here . I tried to write like :

    TwirlKeys.templateImports ++= Seq(
            "views.html.helper._",
            "polaris._",
            "polaris.api._",
            "polaris.models._",
            "polaris.core._",
            "polaris.core.util._",
            "polaris.core.views.html._"
    )

    Then also I am facing the issue like below :

    [error] References to undefined settings: 
    [error] 
    [error]   pbxAppPhonebook/*:twirlTemplateImports from pbxAppPhonebook/*:twirlTemplateImports (/home/nikitha/Documents/Polaris/polaris_sbt_play_scala_upgrade_version/polaris-upgrade-sbt-1.3.0/modules/pbx-app-phonebook/build.sbt:20)
    [error]
    Altern Egro
    @alternegro
    Hello, What's a strategy for contributing to the community? I usually only show up when I have questions, but I really do not want to be a freeloader :-) For all the wonderful people who help answer questions here, how are you able to do it without being overwhelmed? Do you simply set aside community time and do what you can in that allotted time, or do you follow certain topics and just respond to those? Thanks!
    1 reply
    Musery
    @Musery
    Hello everybody, there is a question. I couldn't import play.jobs.job with scala playframework2.X
    Raul Rodriguez
    @raul782
    @Musery probably you refer to the jobs from play 1.x if that is the case I’d recommend switching to https://www.playframework.com/documentation/2.8.x/ScheduledTasks or use your own tasks like https://github.com/jaroop/play-sbt-tasks
    Tanin Na Nakorn
    @tanin_twitter

    Just in case anyone here knows: I can't publish my sbt-web plugin to sonatype (sbt publishSigned). It raises this error:

    {"message":"Organization sbt-web was not found"}

    full error:

    error uploading to io.github.tanin47/sbt-vuefy/scala_2.12/sbt_1.0/6.0.0/srcs/sbt-vuefy-sources.jar: {"message":"Organization sbt-web was not found"}

    Used to publish to bintray without any issue. Anyone knows how to fix this error?

    Igmar Palsenberg
    @igmar
    Isn't bintray shutdown ?
    Nikitha963
    @Nikitha963

    Hi All,

    Can anyone help me in resolving my conf/routes file errors or issues for sub project level project

    Amine Chikhaoui
    @amine.chikhaoui:matrix.org
    [m]
    Is it possible to use spray-json with Play framework ? so that I can parse an incoming request json body using spray ?
    Nikitha963
    @Nikitha963

    Hi All,

    For multi-module project without your app folder at root level and also no conf/routes and conf/application.conf files. It throwed me like resource not found so added both files under root directory , but facing issues on handling routing. The main routing file routes and application.conf and app folder are under modules directory under modules/core/app,modules/core/conf/application.conf and modules/core/conf/routes.

    root directory routes I tried below :

    # app/conf/routes
    # Routes
    # This file defines all application routes (Higher priority routes first)
    # ~~~~
    
    # Home page
    GET        /index                    controllers.Application.index()
    
    #Add sample_module routes
    ->  /core              polaris.core.Routes
    ->  /addressbook       polaris.addressbook.Routes
    ->  /pbx               polaris.pbx.Routes
    ->  /pbxAppCallLog     polaris.pbx.calllog.Routes
    ->  /pbxAppQueues      polaris.pbx.queues.Routes
    ->  /pbxAppClick2dial  polaris.pbx.click2dial.Routes
    ->  /pbxAppPhonebook   polaris.pbx.phonebook.Routes
    ->  /pbxAppOperator    polaris.pbx.operator.Routes
    
    # Map static resources from the /public folder to the /assets URL path
    GET        /assets/*file               controllers.Assets.at(path="/public", file)

    facing error as below :

    conf/routes:7: object Application is not a member of package controllers
    [error] GET / controllers.Application.index()
    object Routes is not a member of package polaris.core
    [error] -> /core polaris.core.Routes
    alexmnyc
    @alexmnyc
    how do you make play generate akkaGrpcCodeGeneratorSettings += "server_power_apis" ?
    i am having a trouble with getting Metadata added
    alexmnyc
    @alexmnyc
    [error] Note: the super classes of class HelloWorldRouter contain the following, non final members named sayHello:
    [error] def sayHello(in: example.myapp.helloworld.grpc.HelloRequest): scala.concurrent.Future[example.myapp.helloworld.grpc.HelloReply]
    [error]   override def sayHello(in: HelloRequest, header: Metadata): Future[HelloReply] = {
    how can i get access to the Metadata
    alexmnyc
    @alexmnyc
    never mind, AbstractGreeterServicePowerApiRouter was generated
    TapanGujjar
    @TapanGujjar

    Hi, I am trying to use a custom HTTP handler with play framework in Java. I know if I throw a runtime exception, by default the onServerError method will be called in the custom HTTP Handler. Can anyone tell me, how the onClientError method in the HTTP Handler will be trigger?

    I know that the onClientError will be invoked when a client error (or error in 4xx series will occur) but how exactly do I throw the client error from inside a controller.

    P.S. I am using the play framework(Java) as a gateway server due to which I need to rethrow the exception thrown by the internal servers.