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

AWS SNS event source crash with error "http: panic serving : runtime error: invalid memory address or nil pointer dereference" #1182

Closed
sanandan opened this issue Apr 21, 2021 · 13 comments · Fixed by #1185
Labels
bug Something isn't working

Comments

@sanandan
Copy link

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. deploy aws sns source, example provided.
  2. setup egress(aws load balancer) on aws sns service
  3. As soon as aws health check hits the 13000 port the service crashes with panic error.
  4. Even without setting up ingress if we curl the sns-event-source service on the port crashes the application.

Expected behavior
HTTP Health check or curl to sns-event-source service should return 200. So the pod can register as healthy under the target group to confirm subscription from SNS

Screenshots
image

Environment (please complete the following information):

  • Kubernetes: v1.19
  • Argo Events: v1.3.0

Additional context
Add any other context about the problem here.


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@sanandan sanandan added the bug Something isn't working label Apr 21, 2021
@sanandan
Copy link
Author

Closing it as it was configuration issue on ingress. I had not mentioned health check path /health. After updating to reflect as mentioned in the doc its registering healthy as expected

@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

@sanandan - thanks for the update, glad to hear it works for you! Even though you are good with it, I want to confirm that when you hit the endpoint with a curl, the pod panics, right? I think that's also an issue we need to fix.

@sanandan
Copy link
Author

yes when i curl -eventsource-svc:12000 the panic happened.

whynowy added a commit to whynowy/argo-events that referenced this issue Apr 21, 2021
Signed-off-by: Derek Wang <whynowy@gmail.com>
@sanandan
Copy link
Author

sanandan commented Apr 21, 2021

@whynowy Please let me know if you need me to reopen this issue.
Also how can enable debug log on eventsource container. It was able tosuccessfully register for subscription, but failed to confirm the subscription.

@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

@sanandan - thanks, I already put a fix there

@whynowy whynowy reopened this Apr 21, 2021
@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

@whynowy Please let me know if you need me to reopen this issue.
Also how can enable debug log on eventsource container. It was able tosuccessfully register for subscription, but failed to confirm the subscription.

Put environment variable DEBUG_LOG: "true" in spec.template.container.envs

@sanandan
Copy link
Author

@whynowy I'm able to set debug_log env variable for eventsource-controller deployments and logs are showing all levels. But since the sns event source deployment is created by eventsource-controller, i'm not able to setup the logs for debug level.

@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

Setting the env in EventSource spec.template.container.envs, the pod will be created with that env.

@sanandan
Copy link
Author

apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
  name: aws-sns
spec:
  service:
    ports:
      - port: 12000
        targetPort: 12000
  sns:
    snowemail:
      topicArn: arn:aws:sns:us-east-1:xxxxx:sns-argo-events
      webhook:
        endpoint: "/"
        port: "12000"
        method: POST
        url: https://xxxxx.execute-api.us-east-1.amazonaws.com
      region: us-east-1
  template:
    container:
      env:
       - name: DEBUG_LOG
         value: 'true'

Even still not getting full log. If i can the subscribe url from the sns confirmation msg then , i should be maually confirm the subscription and test the sns events. Unable to proceed further. The SNS subscription shows as pending.

@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

Do you have the URL https://xxxxx.execute-api.us-east-1.amazonaws.com created in advance?

The logic here is kind of tricky. service used in the spec is only for testing purpose for webhook typed event sources (such as webhook, github, sns, and so on), see the detail at https://github.com/argoproj/argo-events/blob/master/docs/eventsources/services.md.

So for sns, a LB service (or an Ingress) is needed, the service or ingress needs to point to the event source pod. I think pending status you see is because the url is not accessible.

@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

And you can reference to your current ClusterIP type service to create a LB Service (labelSelectors), and remove service field from the EventSource spec.

@sanandan
Copy link
Author

Thankyou @whynowy it was sec group config issue. i'm able to publish and view the messages in the log :)

@whynowy
Copy link
Member

whynowy commented Apr 21, 2021

Thankyou @whynowy it was sec group config issue. i'm able to publish and view the messages in the log :)

👍

whynowy added a commit that referenced this issue Apr 22, 2021
Signed-off-by: Derek Wang <whynowy@gmail.com>
whynowy added a commit that referenced this issue May 4, 2021
Signed-off-by: Derek Wang <whynowy@gmail.com>
juliev0 pushed a commit to juliev0/argo-events that referenced this issue Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants