title: Lambda raise a syntax error on a match operation
body: <p>I'm trying to create a Lambda function that works on my machine, but when I test it I receive the following error:</p>
  <pre><code>Response
  {
    &quot;errorMessage&quot;: &quot;Syntax error in module 'lambda_function': invalid syntax (lambda_function.py, line 64)&quot;,
    &quot;errorType&quot;: &quot;Runtime.UserCodeSyntaxError&quot;,
    &quot;requestId&quot;: &quot;ae5f2481-a836-4b4e-8c8d-a82ccd12c630&quot;,
    &quot;stackTrace&quot;: [
      &quot;  File \&quot;/var/task/lambda_function.py\&quot; Line 64\n        match operation:\n&quot;
    ]
  }
  
  Function Logs
  START RequestId: ae5f2481-a836-4b4e-8c8d-a82ccd12c630 Version: $LATEST
  [ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'lambda_function': invalid syntax (lambda_function.py, line 64)
  Traceback (most recent call last):
    File &quot;/var/task/lambda_function.py&quot; Line 64
          match operation:END RequestId: ae5f2481-a836-4b4e-8c8d-a82ccd12c630
  REPORT RequestId: ae5f2481-a836-4b4e-8c8d-a82ccd12c630  Duration: 1.34 ms   Billed Duration: 2 ms   Memory Size: 128 MB Max Memory Used: 35 MB  Init Duration: 117.69 ms
  
  Request ID
  ae5f2481-a836-4b4e-8c8d-a82ccd12c630
  </code></pre>
  <p>So after hours wasted:</p>
  <ul>
  <li>I cannot see any syntax error.</li>
  <li>I've tried bundling the enum package (don't know if it is necessary).</li>
  <li>I've also commented any line that uses external parameters.</li>
  <li>I'm using Python 3.9 in Lambda and python 3.10 in local.</li>
  <li>The the logs point always to line 64 <code>    match operation:</code> in the function <code>get_url</code></li>
  </ul>
  <p>This is the code until the function with the error:</p>
  <pre><code>import requests
  import json
  from enum import Enum
  import urllib.parse
  import boto3
  import base64
  
  max_number_of_digit = 1
  base_url = &quot;https://somesite.io&quot;
  app_version = &quot;version-test/&quot;
  bubble_api_token = &quot;some api token&quot;
  pdf_creator_api_token = 'some other api token'
  
  
  class APP_ENTITY(str, Enum):
      PROJECT = &quot;project&quot;
      COMPANY = &quot;company&quot;
      PAYMENT = &quot;payment&quot;
      TRANCHE = &quot;tranche&quot;
      COST_ITEMS = &quot;payment&quot;
      DOCUMENT = &quot;document&quot;
  
  
  class OPERATIONS(int, Enum):
      CREATE = 1
      DELETE = 2
      PATCH = 3
      READ = 4
      GET = 5
  
  
  document = dict()
  customer = dict()
  base_assets = [
      'bank.png',
      'calculator.png',
      'card.png',
      'caret.png',
      'jetbrains-mono-v11-latin-500.woff2',
      'jetbrains-mono-v11-latin-regular.woff2',
      'line.png',
      'logo.svg',
      'poppins-v19-latin-300.woff2',
      'poppins-v19-latin-500.woff2',
      'poppins-v19-latin-600.woff2',
      'poppins-v19-latin-regular.woff2',
      'style.css'
  ]
  
  
  def set_app_version(event):
      global app_version
      result = &quot;version-test/&quot;
      try:
          result = event['queryStringParameters']['appversion']
          result = &quot;&quot; if (result.lower() != 'test') else &quot;version-test/&quot;
      except:
          result = &quot;version-test/&quot;
      app_version = result
      return result
  
  
  def get_url(operation: OPERATIONS, entity: APP_ENTITY, cursor: int = 0, record_id: str = &quot;&quot;, project_id: str = &quot;&quot;):
      match operation:
          case OPERATIONS.CREATE:
              result = base_url + \
                  &quot;/{}api/1.1/obj/{}/bulk&quot;.format(app_version, entity)
          case OPERATIONS.DELETE:
              result = base_url + \
                  &quot;/{}api/1.1/obj/{}/&quot;.format(app_version, entity)
          case OPERATIONS.PATCH:
              result = base_url + \
                  &quot;/{}api/1.1/obj/{}/{}&quot;.format(app_version, entity, record_id)
          case OPERATIONS.READ:
              match entity:
                  case APP_ENTITY.COST_ITEMS:
                      result = base_url + \
                          &quot;/{}api/1.1/obj/{}/?api_token={}&amp;cursor={}&amp;constraints=&quot;.format(
                              app_version, entity, bubble_api_token, cursor)
                      constraints = [
                          {
                              &quot;key&quot;: &quot;type&quot;,
                              &quot;constraint_type&quot;: &quot;equals&quot;,
                              &quot;value&quot;: &quot;development&quot;
                          },
                          {
                              &quot;key&quot;: &quot;project&quot;,
                              &quot;constraint_type&quot;: &quot;equals&quot;,
                              &quot;value&quot;: project_id
                          }]
                      constraints = urllib.parse.quote_plus(
                          json.dumps(constraints))
                      result = result+constraints
          case OPERATIONS.GET:
              result = base_url + \
                  &quot;/{}api/1.1/obj/{}/{}&quot;.format(app_version, entity, record_id)
      return result
  </code></pre>
  <p>Below a screenshot of the lambda console.
  <a href="https://i.stack.imgur.com/j5sv8.png" rel="nofollow noreferrer">Lambda console</a></p>
  <p>And here a screenshot of the error:
  <a href="https://i.stack.imgur.com/Gl8Ij.png" rel="nofollow noreferrer">Lambda error</a></p>