Skip to content
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

azure-functions-maven-plugin 1.17.0 breaks package goal #2514

Closed
Djesco opened this issue Nov 26, 2024 · 2 comments
Closed

azure-functions-maven-plugin 1.17.0 breaks package goal #2514

Djesco opened this issue Nov 26, 2024 · 2 comments

Comments

@Djesco
Copy link

Djesco commented Nov 26, 2024

For a HttpTrigger function project I am trying to update the azure-functions-maven-plugin to the latest version (1.36.0). But starting at version 1.17.0 the mvn azure-functions:package goal breaks.

It fails at Step 1 of 8: Searching for Azure Functions entry points and only gives me the following error:
[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.17.0:package (package-functions) on project eab-function: com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException: com.microsoft.azure.functions.annotation.FunctionName -> [Help 1]
If I try to run maven with -e or -X it only gives me the stack trace, no other specific error.

When I upgrade the function to version 1.19.0 and later it gives a slightly more specific error:
[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.19.0:package (package-functions) on project eab-function: generate configuration files and prepare staging directory: AzureToolkitRuntimeException: com.microsoft.azure.functions.annotation.FunctionName -> [Help 1]

I already tried looking at the documentation for this plugin but there is nothing mentioned in the changelog for version 1.17.0, my azure CLI is updated to the latest version and core tools is as well.

This is my plugin configuration:

<plugin>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-functions-maven-plugin</artifactId>
    <version>1.17.0</version>
    <configuration>
        <resourceGroup>FAKE-rg</resourceGroup>
        <region>westeurope</region>
        <appName>${functionAppName}</appName>
        <runtime>
            <os>linux</os>
            <javaVersion>17</javaVersion>
        </runtime>
        <appSettings>
            <property>
                <name>WEBSITE_RUN_FROM_PACKAGE</name>
                <value>1</value>
            </property>
            <property>
                <name>FUNCTIONS_EXTENSION_VERSION</name>
                <value>~4</value>
            </property>
        </appSettings>
    </configuration>
    <executions>
        <execution>
            <id>package-functions</id>
            <goals>
                <goal>package</goal>
            </goals>
        </execution>
    </executions>
</plugin>

And this is my HttpTrigger code:

public class Function extends AzureHttpFunction {

    @FunctionName("HttpTrigger")
    public HttpResponseMessage invoke(@HttpTrigger(name = "req", methods = { HttpMethod.GET }, route = "{*route}",
            authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
            final ExecutionContext context) {
        
        context.getLogger().fine("Http trigger uri " + request.getUri());
        ThreadContext.put("id", context.getInvocationId());
        
        return super.route(request, context);
    }
}
@Djesco
Copy link
Author

Djesco commented Nov 26, 2024

Wondering if it could have something to do with this PR: 476cc6e

@Djesco
Copy link
Author

Djesco commented Nov 26, 2024

I was correct in my assumption that the PR mentioned in my previous comment was the culprit.

To be precise, the removal of this dependency was causing my problem

<dependency>
            <groupId>com.microsoft.azure.functions</groupId>
            <artifactId>azure-functions-java-library</artifactId>
</dependency>

I added back the dependency and was able to upgrade to version 1.36.0 without further issue

@Djesco Djesco closed this as completed Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant