Skip to content

Migrate to CloudFunctions v1 API. #165

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

Merged
merged 2 commits into from
Mar 25, 2020
Merged

Migrate to CloudFunctions v1 API. #165

merged 2 commits into from
Mar 25, 2020

Conversation

mather
Copy link
Contributor

@mather mather commented Apr 23, 2019

Motivation

We should use v1 API asap.

The Cloud Functions v1beta2 API is deprecated. To avoid potential service disruptions, please use the Cloud Functions v1 API instead.
https://cloud.google.com/functions/docs/api-migration

Changes

  • location property migrate to parent.
  • Use entryPoint property to specify handler function.
  • Use function property for stage-distinct function name to avoid confusion of function name in GCP console and confliction of http event endpoint URL.

Related Issues

#105

- 'location' property migrate to 'parent'.
- Use 'entryPoint' property to specify handler function.
- Use 'function' property for stage-distinct function name.
@mather
Copy link
Contributor Author

mather commented Jun 14, 2019

@pmuens Is this plugin no more maintained?

@davidjb99
Copy link

Would be good to get this merged...

@dee-me-tree-or-love
Copy link

Awesome, really looking forward to this!
This would also then need the doc updates here right?
https://serverless.com/framework/docs/providers/google/

@mather
Copy link
Contributor Author

mather commented Sep 4, 2019

This would also then need the doc updates here right?
https://serverless.com/framework/docs/providers/google/

I think so.

@haflinger
Copy link

Hi, is this plugin maintained ?

@about0
Copy link

about0 commented Mar 10, 2020

Hey! Any update?

@paladiy
Copy link

paladiy commented Mar 11, 2020

Hey, are you planning to move this PR forward? Google is pushing people to migrate from beta API

@nahpeps
Copy link

nahpeps commented Mar 12, 2020

@mather Any chance you solve the conflicts in this branch, so that it may can get finally merged?

@ishallbethat
Copy link

Can please help get it merged asap ?

@ishallbethat
Copy link

Google sent notification to force use v1.
Hello Google Cloud Functions Customer,

In June 2018, we announced Cloud Functions v1beta2 API version will be shut down on December 4, 2018. In order to give customers more time to migrate, we extended the deadline and we are now writing to let you know that the Google Cloud Functions v1beta2 API version will be shut down on April 15, 2020.

We are writing to remind you that your projects have recently made calls to the Cloud Functions v1beta2 API. Please upgrade to Cloud Functions v1 API by April 15, 2020. Google Cloud Functions v1 API has been available since October 2017.

@ishallbethat
Copy link

@mather can you please help resolve the conflicts and have this PR merged ? we're in really need to use v1 cloudfunction.

Conflicts:
	info/lib/displayServiceInfo.js
	package/lib/compileFunctions.js
	package/lib/compileFunctions.test.js
@mather
Copy link
Contributor Author

mather commented Mar 21, 2020

I have resolved conflicts. Anyone can review this PR?

@mather
Copy link
Contributor Author

mather commented Mar 22, 2020

When does Coveralls finish coverage tests...?

@medikoo
Copy link
Contributor

medikoo commented Mar 22, 2020

@mather We're going to take this now. I understand it's a breaking change (?)

@medikoo medikoo self-assigned this Mar 22, 2020
@mather
Copy link
Contributor Author

mather commented Mar 24, 2020

It seems passed coverage tests already 🤔
https://coveralls.io/builds/29518088

@ishallbethat
Copy link

Why it still says merging is blocked ? @KhadijaBenAmmar @medikoo

@medikoo
Copy link
Contributor

medikoo commented Mar 25, 2020

@IamGabrielWu I'm happy to merge and publish it now.

There's just one thing I want to be sure of:

I understand that it's a (semver wise) breaking change, and requires bump of major to v3 (?)

@mather
Copy link
Contributor Author

mather commented Mar 25, 2020

@medikoo

requires bump of major to v3 (?)

Umm. I think this is minor update because this update doesn't have any interface modification on user side.

@medikoo medikoo merged commit 59fe8ce into serverless:master Mar 25, 2020
@medikoo
Copy link
Contributor

medikoo commented Mar 25, 2020

It's published with v2.4.2 Sorry for delay!

@paladiy
Copy link

paladiy commented Mar 26, 2020

@medikoo Thank you for moving this forward.

I've already tried to upgrade our existing GCFs to new version and got error:

Resource types cannot be changed, previous (cloudfunctions.v1beta2.function) -> updated (gcp-types/cloudfunctions-v1:projects.locations.functions)

Googling around did not pointed to anything, but seems like it is because of the version change. Do you have any idea what could be a reason of this issue?

@mather mather deleted the feature/migrate-to-cloudfunctions-v1 branch March 26, 2020 01:17
@medikoo
Copy link
Contributor

medikoo commented Mar 26, 2020

Do you have any idea what could be a reason of this issue?

It might be then that it requires creation of a stack from a start (I'm not that familiar with Google Cloud), but if it's the case. then this change should be reverted in context of v2, and published with v3 as breaking.

Before I do that, I'd love other users to confirm

@paladiy
Copy link

paladiy commented Mar 26, 2020

yes, seems like it is the case, I've just tried to deploy function with different name (meaning create new one) and it worked well. thx

@mather
Copy link
Contributor Author

mather commented Mar 27, 2020

then this change should be reverted in context of v2, and published with v3 as breaking.

Sure.
Sorry for not considering migration in production environment.

@bao1018
Copy link
Contributor

bao1018 commented Mar 27, 2020

Thanks for the workaround, we will try to research solution to fix that migration challenge @paladiy

@ishallbethat
Copy link

anybody gets this error after 2nd time deployment using this v1 api ?
{"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message":"Invalid JSON payload received. Unknown name \"location\" at 'function': Cannot find field.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"function","description":"Invalid JSON payload received. Unknown name \"location\" at 'function': Cannot find field."}]}],"statusMessage":"Bad Request","requestPath":"https://cloudfunctions.googleapis.com/v1/projects/<project name>/locations/us-central1/functions/<function name>","httpMethod":"PATCH"}}

@ishallbethat
Copy link

ishallbethat commented Mar 30, 2020

zxhaaa6 added a commit to bao1018/serverless-google-cloudfunctions that referenced this pull request Apr 1, 2020
zxhaaa6 added a commit to bao1018/serverless-google-cloudfunctions that referenced this pull request Apr 1, 2020
@xerosanyam
Copy link

Got error "The GCF v1beta2 API is deprecated"

Solved by

  1. npm install serverless-google-cloudfunctions@latest
  2. Following Option-1 of migration guide, from here: https://github.com/serverless/serverless-google-cloudfunctions/blob/HEAD/MIGRATION_GUIDE.md

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

Successfully merging this pull request may close these issues.