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

fix: Fix deployment status when the function name is specified #225

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

knightdna
Copy link
Contributor

  • fixes the logic to get the function name in service
  • handles the case when the specified function name contains dash
  • adds test case

@knightdna knightdna changed the title fix: Fix deployment status when the function name is specified (#224) fix: Fix deployment status when the function name is specified Jul 2, 2020
@ishallbethat
Copy link

ishallbethat commented Jul 3, 2020

I still got the error with your PR code @knightdna

> sls deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Compiling function "first"...
Serverless: Creating deployment...
Serverless: Checking deployment create progress...
..
Serverless: Done...
Serverless: Uploading artifacts...
Serverless: Artifacts successfully uploaded...
Serverless: Updating deployment...
Serverless: Checking deployment update progress...
................
Serverless: Done...

  Serverless Error ---------------------------------------

  Function "cf_test_pubsub_helloworld_python_usce1_v1" doesn't exist in this Service

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              10.13.0
     Framework Version:         1.67.3
     Plugin Version:            3.6.6
     SDK Version:               2.3.0
     Components Version:        2.29.3

>

but the function name is correct.
image

@ishallbethat
Copy link

ishallbethat commented Jul 3, 2020

Turns out the function field has to be the same as the function name. It then works.

functions:
  cf_test_pubsub_helloworld_python_usce1_v1: <here>
    handler: http
    name: cf_test_pubsub_helloworld_python_usce1_v1 <here>
    events:
      - http: path

my serverless.yaml

service: helloworld-python

provider:
  name: google
  stage: dev
  runtime: python37
  region: us-central1
  project: aftership-dev
  # The GCF credentials can be a little tricky to set up. Luckily we've documented this for you here:
  # https://serverless.com/framework/docs/providers/google/guide/credentials/
  #
  # the path to the credentials file needs to be absolute
  credentials: xxxx
plugins:
  - serverless-google-cloudfunctions

# needs more granular excluding in production as only the serverless provider npm
# package should be excluded (and not the whole node_modules directory)
package:
  exclude:
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  cf_test_pubsub_helloworld_python_usce1_v1:
    handler: http
    name: cf_test_pubsub_helloworld_python_usce1_v1
    events:
      - http: path
  # NOTE: the following uses an "event" event (pubSub event in this case).
  # Please create the corresponding resources in the Google Cloud
  # before deploying this service through Serverless
  #second:
  #  handler: event
  #  events:
  #    - event:
  #        eventType: providers/cloud.pubsub/eventTypes/topic.publish
  #        resource: projects/*/topics/my-topic
# you can define resources, templates etc. the same way you would in a
# Google Cloud deployment configuration
#resources:
#  resources:
#    - type: storage.v1.bucket
#      name: my-serverless-service-bucket
#  imports:
#    - path: my_template.jinja

Copy link

@ishallbethat ishallbethat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems good to ok. Just one thing i figure out the function name has to be same as the name

@ishallbethat
Copy link

ishallbethat commented Jul 15, 2020

@knightdna @medikoo I already made approval for changes. It seems still need a approving review. How can i make one ? Or anyone else can do it ?

Copy link

@ishallbethat ishallbethat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IamGabrielWu for reviewing!

@medikoo medikoo merged commit 251e1cf into serverless:master Jul 16, 2020
@ishallbethat
Copy link

@medikoo thanks for merging this. when will the fix be released ?

@medikoo
Copy link
Contributor

medikoo commented Jul 17, 2020

@IamGabrielWu for release I believe we need to revert #219 as it brought the regression which was not addressed yet (handled here: #223)

Are you able to prepare a "Revert PR", usually GitHub provides button to do so at merged PR page, do you see it?

Having that fixed, we can go with release PR (merging it in will publish new version)

@knightdna
Copy link
Contributor Author

Thanks a lot @IamGabrielWu for reviewing and approving this PR as well as @medikoo for merging it.

I can also help to prepare the revert PR.

@knightdna knightdna deleted the deployment-status branch July 17, 2020 09:57
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.

3 participants