使用SAM在本地运行时,如何在go lambda的环境变量中获取SQS URL?

I'm trying to develop a serverless application using cloudformation. I need a go lambda function to send messages in a SQS. To send these messages, I need a queue URL. I am supposed to store this URL in my lambda function's environment variables.

But when I run it locally, with sam local start-api, my variable is empty. When I deploy it, it works, but I can't test it locally.

Here is my template.yaml:

  APIGetFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: service_get_person 
      Runtime: go1.x
      CodeUri: ./src/person/service/get_person
      Description: 'Get a person'
      MemorySize: 128
      Timeout: 30
      Role: !GetAtt LambdaExecutionRole.Arn
      Events:
        GetEvent:
          Type: Api
          Properties:
            Path: /person
            Method: get
      Environment:
        Variables:
          QueueUrl: !Ref MyQueue
          REGION: eu-west-3

  MyQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: test_queue
      DelaySeconds: 0
      VisibilityTimeout: 120

I'm using os.Getenv("QueueUrl") to get my variables.

Do any of you have the solution to solve this problem?