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

Task azureFunctionsDeploy fails if runtime is not configured #69

Closed
ghost opened this issue Sep 22, 2020 · 1 comment
Closed

Task azureFunctionsDeploy fails if runtime is not configured #69

ghost opened this issue Sep 22, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 22, 2020

Hi everyone,

with the following contents of my Gradle file:

plugins {
  id 'java'
  id 'maven-publish'
  id "com.microsoft.azure.azurefunctions" version "1.4.0"
}

repositories {
  mavenLocal()
  maven {
    url = 'https://repo.spring.io/libs-snapshot-local'
  }

  maven {
    url = 'https://repo.spring.io/libs-milestone-local'
  }

  maven {
    url = 'https://repo.spring.io/release'
  }

  maven {
    url = 'http://repo.maven.apache.org/maven2'
  }
  mavenCentral()
}

dependencies {
  implementation 'org.springframework.cloud:spring-cloud-function-adapter-azure:3.0.10.RELEASE'
  compileOnly 'org.springframework.cloud:spring-cloud-starter-function-web:3.0.10.RELEASE'
  implementation 'io.jsonwebtoken:jjwt-impl:0.11.2'
  implementation 'io.jsonwebtoken:jjwt-jackson:0.11.2'
  implementation 'org.springframework:spring-web:5.2.9.RELEASE'
  compileOnly 'org.projectlombok:lombok:1.18.12'
  annotationProcessor 'org.projectlombok:lombok:1.18.12'

  testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE'
  testCompileOnly 'org.projectlombok:lombok:1.18.12'
  testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
}

group = 'my.company'
version = '0.0.1-SNAPSHOT'
description = 'my-app-name'
sourceCompatibility = '1.8'

publishing {
  publications {
    maven(MavenPublication) {
      from(components.java)
    }
  }
}

tasks.withType(JavaCompile) {
  options.encoding = 'UTF-8'
}

jar {
  manifest {
    attributes 'Main-Class': 'my.springboot.Application'
  }
}

azurefunctions {
  resourceGroup = 'my-resource-group'
  appName = 'my-app-name'
  region = 'westeurope'
  runtime {
    os = 'windows'
  }
  appSettings {
    WEBSITE_RUN_FROM_PACKAGE = '1'
    FUNCTIONS_EXTENSION_VERSION = '~3'
    FUNCTIONS_WORKER_RUNTIME = 'java'
    MAIN_CLASS = 'my.springboot.Application'
  }
}

The azureFunctionsDeploy task was always failing with

> Task :azureFunctionsDeploy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':azureFunctionsDeploy'.
> java.lang.NullPointerException (no error message)

I had to use the --stacktrace argument to find out, that this happens when the runtime element of the context is accessed at com.microsoft.azure.plugin.functions.gradle.handler.DeployHandler.execute(DeployHandler.java:106). So adding a runtime element into the configuration fixed the problem. Nevertheless, runtime is marked as an optional configuration parameter.

Cheers
Patrick

@andxu
Copy link
Contributor

andxu commented Sep 23, 2020

Hi @ama-patrick, thank you for using gradle plugin. I will fix this NPE in 1.5.0

andxu pushed a commit that referenced this issue Sep 23, 2020
@andxu andxu closed this as completed Sep 24, 2020
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