Issues deploying Hilla on Fly.io, with Paketo

Hi all!

I’ve been trying to deploy Hilla on Fly.io, using Paketo buildpacks.

However, I get some intermittent errors, and the latest example is here - it’s a Spring Boot app.

I was just curious if anyone had any ideas on how to resolve this? The app needs to be a native image, so I can scale from zero when the app is first hit.

Thank you!

1 Like

Hi @shymega ,

You mentioned the error being intermittent. Have you been able to complete a successful build/deploy?

What’s the error you get?

Here’s a Dockerfile and GH workflow I’ve used to publish a GraalVM native Hilla app to fly.io:

2 Likes

Hey! I’ve never had a successful build. It sometimes presents different errors on each fix I try.

The current error logs (below) is on the current config, which should be sane. At this point, I’m wondering if it’s a Paketo bug.

The recurring error is as follows. I believe it’s a bug, but I can see the Hilla Maven plugin goal referenced in the log is just extended from Flow - hence why I mentioned it on GitHub:

      [INFO] 
      [INFO] >>> hilla:2.5.7:prepare-frontend (default) > :configure @ shsponsors >>>
      [INFO] 
      [INFO] --- hilla:2.5.7:configure (configure) @ shsponsors ---
      [INFO] 
      [INFO] <<< hilla:2.5.7:prepare-frontend (default) < :configure @ shsponsors <<<
      [INFO] 
      [INFO] 
      [INFO] --- hilla:2.5.7:prepare-frontend (default) @ shsponsors ---
      [INFO] Couldn't find node. Installing Node and npm to /home/cnb/.vaadin.
      [INFO] Installing node version v20.11.1
      [INFO] Downloading https://nodejs.org/dist/v20.11.1/node-v20.11.1-linux-x64.tar.gz to /home/cnb/.vaadin/node-v20.11.1-linux-x64.tar.gz
      [INFO] No proxies configured. If you are behind a proxy server, see https://vaadin.com/docs/latest/configuration/development-mode/node-js#proxy-settings-for-downloading-frontend-toolchain for information on proxy configuration.
      [INFO] Unpacking /home/cnb/.vaadin/node-v20.11.1-linux-x64.tar.gz (46621070 bytes) into /home/cnb/.vaadin/node/tmp
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  12.524 s
      [INFO] Finished at: 2024-04-25T15:15:28Z
      [INFO] ------------------------------------------------------------------------
Error: ERROR] Failed to execute goal dev.hilla:hilla-maven-plugin:2.5.7:prepare-frontend (default) on project shsponsors: Execution default of goal dev.hilla:hilla-maven-plugin:2.5.7:prepare-frontend failed: An API incompatibility was encountered while executing dev.hilla:hilla-maven-plugin:2.5.7:prepare-frontend: java.lang.NoSuchMethodError: 'long org.apache.commons.io.IOUtils.skip(java.io.InputStream, long, java.util.function.Supplier)'

Just looking at your exception; I’ve got a strong feeling you are using outdated libraries - like your commons-io. Please update to the latest version.

I’m not currently using commons-io in my POM, but it might be pulled in by Spring or Hilia.

I’m currently using JDK 21, and the latest versions of Hilla (?) & Spring.

I did try and downgrade to the versions in @marcushellberg’s POM, with the same error.

This is using Paketo Buildpacks, which I’d prefer to keep intact.

You can check with mvn -X the full stack trace. It would probably also help to just specify the dependency then. Looks like a missmatch; commons-io is widely used.

Sorry for the delay. In the end, I went back to Vaadin. I am going to push the last commit where it used Hilla (and broken) to a separate, minimal repository on GitHub. I’ll get that done this weekend. This should be useful to debug in an isolated, reproducible environment.

I’ve identified another issue on a different project. I can’t share the sources of this, but in this case, running Paketo CLI directly, I get a very different error.

The command used to generate the project was via the CLI. This was the command: npx @hilla/cli init --preset=hilla-crm-tutorial $projectdir, where $projectdir is the name of the project’s directory.

This is the stack trace from the freshly created Hilla project (using the CLI):

[builder]       [INFO] --- hilla:2.5.7:build-frontend (default) @ <REDACTED> ---
[builder]       [INFO] Reflections took 444 ms to scan 134 urls, producing 9576 keys and 50677 values
[builder]       [INFO] Scanning classes to find frontend configurations and dependencies...
[builder]       [INFO] Visited 4123 classes. Took 1335 ms.
[builder]       [INFO] Checking if a production mode bundle build is needed
[builder]       [WARNING] There is no prod-bundle in the project or on the classpath nor is there a default production bundle included.
[builder]       [INFO] No bundle's stats.json found for production-bundle validation.
[builder]       [INFO] A production mode bundle build is needed
[builder]       [INFO] Running `npm install` to resolve and optionally download frontend dependencies. This may take a moment, please stand by...
[builder]       [INFO] using '/layers/paketo-buildpacks_node-engine/node/bin/npm --no-update-notifier --no-audit --scripts-prepend-node-path=true --ignore-scripts install' for frontend package installation
[builder]       [INFO] Frontend dependencies resolved successfully.
[builder]       [INFO] Search for endpoints in directories [/workspace/target/classes]
[builder]       [INFO] Copying frontend resources from jar files ...
[builder]       [INFO] Visited 133 resources. Took 45 ms.
[builder]       [INFO] ------------------------------------------------------------------------
[builder]       [INFO] BUILD FAILURE
[builder]       [INFO] ------------------------------------------------------------------------
[builder]       [INFO] Total time:  18.082 s
[builder]       [INFO] Finished at: 2024-05-03T20:49:45Z
[builder]       [INFO] ------------------------------------------------------------------------
[builder]       [ERROR] Failed to execute goal dev.hilla:hilla-maven-plugin:2.5.7:build-frontend (default) on project <REDACTED>: Execution default of goal dev.hilla:hilla-maven-plugin:2.5.7:build-frontend failed: Unable to locate Vite executable by path '/workspace/node_modules/vite/bin/vite.js'. Double check that the plugin is executed correctly -> [Help 1]

I can’t help but wonder if I need to make an upstream issue for these two bugs. The forums are a good place for troubleshooting, but given the commons-io error, and then the vite.js error, I think this is something more sets of eyes need to investigate. Of course, it’s not up to me what the priority is; as a maintainer myself, I understand this. But possibly worth investigating.

I found this happened even outside of a Paketo build, I resolved it by adding the following dependency override to the hilla-maven-plugin section of my pom.xml


		<plugin>
			<groupId>dev.hilla</groupId>
			<artifactId>hilla-maven-plugin</artifactId>
			<version>${hilla.version}</version>
                       <dependencies>
                            <dependency>
                                  <groupId>commons-io</groupId>
                                  <artifactId>commons-io</artifactId>
                                  <version>2.16.1</version>
                             </dependency>
                      </dependencies>
		</plugin>