# Does serverless framework support GCP deployment for java functions?

**URL:** <https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187>\
**Category:** Serverless Framework\
**Tags:** google\
**Created:** [November 23, 2020, 4:53am UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187 "2020-11-23T04:53:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![leo7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/leo7/32/4757_2.png) [@leo7](https://forum.serverless.com/u/leo7)\
**Post date:** [November 23, 2020, 4:53am UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187/1 "2020-11-23T04:53:29Z")

</div>

I am trying to deploy an existing aws serverless stack to gcp, it is currently implemented by using java8.

I did a couple of tests by using python and it works. But I changed the handler to java class, I got this error

```auto
Error: The "handler" property for the function "bsFileTransferInitProcessor" is invalid. Handlers should be plain strings referencing only the exported function name without characters such as "." or "/" (so e.g. "http" instead of "index.http"). Do you want to nest your functions code in a subdirectory? Google solves this by utilizing the "main" config in the projects package.json file. Please check the docs for more info.
      at /home/leo/workspace/data-receipt-station/node_modules/serverless-google-cloudfunctions/shared/validate.js:50:15
      at /home/leo/workspace/data-receipt-station/node_modules/lodash/lodash.js:4925:15

```

So please advice when it is supported or any work-round for this issue?

---

<div class="post-metadata">

**Author:** ![cotrariello](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@cotrariello](https://forum.serverless.com/u/cotrariello)\
**Post date:** [April 7, 2021, 10:55am UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187/2 "2021-04-07T10:55:15Z")

</div>

Hi Leo,  
did you solve it?

---

<div class="post-metadata">

**Author:** ![leo7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/leo7/32/4757_2.png) [@leo7](https://forum.serverless.com/u/leo7)\
**Post date:** [April 8, 2021, 1:03am UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187/3 "2021-04-08T01:03:07Z")

</div>

Hi @cotrariello , yeah I worked around by creating a Handler class in root package (under src/main/java), then that class extends the real handler.  
I don’t think the GCP and Serverless fully support java Functions, suggest you to use python for new project. If like me, I already got some working code in Java and trying to deploy it to GCP, then here are some hints

- java8 functions works well in java11 environment in GCP
- the handler path issue you mentioned above
- the serverless requires the artifact to be in a .zip file, so you need to put your jar into a zip file, then upload it

---

<div class="post-metadata">

**Author:** ![cotrariello](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@cotrariello](https://forum.serverless.com/u/cotrariello)\
**Post date:** [April 19, 2021, 7:43am UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187/4 "2021-04-19T07:43:53Z")

</div>

Hi @leo7 , thank you for the reply. I also solved by putting the Java Handler Class in the root folder.  
Only one question, what do you mean in the last point? Because I generate the jar artifact and it works fine.

---

<div class="post-metadata">

**Author:** ![leo7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/leo7/32/4757_2.png) [@leo7](https://forum.serverless.com/u/leo7)\
**Post date:** [April 19, 2021, 10:47pm UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187/5 "2021-04-19T22:47:44Z")

</div>

Hi @cotrariello , that is good if you can use jar, instead of a zip file. That didn’t work for me, but I may give it another try

---

<div class="post-metadata">

**Author:** ![cotrariello](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@cotrariello](https://forum.serverless.com/u/cotrariello)\
**Post date:** [April 28, 2021, 10:06am UTC](https://forum.serverless.com/t/does-serverless-framework-support-gcp-deployment-for-java-functions/13187/6 "2021-04-28T10:06:02Z")

</div>

Hi @leo7 , with the new version of the framework it does not work for me too. So I deployed the function directly from the Google Console using the zip version as you suggest. Thank you.
