aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.47k stars 1.16k forks source link

Access to internal enterprise host (Github entreprise) #7121

Open embaya opened 4 weeks ago

embaya commented 4 weeks ago

Description

I try to call github enterprise with my application (in Go) with SAM local, but I get a timeout (the code runs fine without SAM).I suspect a network access problem, so I tried adding a VpcConfig (SubnetIds and SecurityGroupIds) in the template but it didn't change anything. I also tried running my command like this (sam local invoke --profile=dev --region=eu-west-3 --docker-network host), but still the same problem. I connected to the container to call my github and I have the problem. Knowing that I have no problems with other images

Any ideas

Template

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
  Function:
    Timeout: 5

Resources:
  GithubTokenFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: makefile
    Properties:
      CodeUri: .
      Handler: generate_github_token
      Runtime: go1.x
      Timeout: 45
      Architectures:
        - x86_64

Environment

SAM CLI, version 1.118.0 Archlinux

hnnasit commented 3 weeks ago

Hi @embaya, thanks for reporting the issue. Are you able to provide the lambda function code and steps to reproduce the behavior? Trying to replicate the behavior to see what's happening.