Describe the bug
Cant setup Run/Debug locally, somehow it fails loading the template when I select in the Resource in the template to configure.
"Error: Function logical name must be specified."
Screenshots

Your Environment
Is the logical name combo box blank? it is to the right of the template browser.
Is the logical name combo box blank? it is to the right of the template browser.
yes is empty and I cannot modify I guess is auto-completed by the selected template file.
Can you paste in the template file that you have open in the screenshot? Also please check the idea.log for errors loading the template file.
through the run icon.
This log can help?
2018-11-19 13:41:43,353 [ 218571] WARN - execution.sam.SamTemplateUtils - Failed to parse template: file:///home/federico/work-personal/PythonScripts/src/main/aws/cloudformation/template-local.yaml
java.lang.UnsupportedOperationException: Only YAML CloudFormation templates are supported
at software.aws.toolkits.jetbrains.services.cloudformation.CloudFormationTemplate$Companion.parse(CloudFormationTemplate.kt:30)
at software.aws.toolkits.jetbrains.services.lambda.execution.sam.SamTemplateUtils.findFunctionsFromTemplate(SamTemplateUtils.kt:32)
at software.aws.toolkits.jetbrains.services.lambda.execution.sam.SamTemplateUtils.findFunctionsFromTemplate(SamTemplateUtils.kt:27)
at software.aws.toolkits.jetbrains.services.lambda.execution.sam.SamRunConfiguration$MutableLambdaSamRunSettings.validateAndCreateImmutable(SamRunConfiguration.kt:165)
at software.aws.toolkits.jetbrains.services.lambda.execution.sam.SamRunConfiguration.checkConfiguration(SamRunConfiguration.kt:62)
at com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl.checkSettings(RunnerAndConfigurationSettingsImpl.kt:321)
at com.intellij.execution.RunnerAndConfigurationSettings.checkSettings(RunnerAndConfigurationSettings.java:116)
at com.intellij.execution.impl.TimedIconCache.calcIcon(TimedIconCache.kt:66)
at com.intellij.execution.impl.TimedIconCache.access$calcIcon(TimedIconCache.kt:18)
at com.intellij.execution.impl.TimedIconCache$get$$inlined$write$lambda$1.fun(TimedIconCache.kt:50)
at com.intellij.execution.impl.TimedIconCache$get$$inlined$write$lambda$1.fun(TimedIconCache.kt:18)
at com.intellij.ui.DeferredIconImpl.evaluate(DeferredIconImpl.java:282)
at com.intellij.ui.DeferredIconImpl.lambda$null$0(DeferredIconImpl.java:167)
at com.intellij.ui.IconDeferrerImpl.evaluateDeferred(IconDeferrerImpl.java:114)
at com.intellij.ui.DeferredIconImpl.lambda$null$1(DeferredIconImpl.java:167)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1161)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:70)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:123)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:112)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:70)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:91)
at com.intellij.ui.DeferredIconImpl.lambda$paintIcon$4(DeferredIconImpl.java:166)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:226)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$100(BoundedTaskExecutor.java:26)
at com.intellij.util.concurrency.BoundedTaskExecutor$2$1.run(BoundedTaskExecutor.java:199)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:229)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:193)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
```AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Resources:
TrackingPackageLambda:
Type: "AWS::Serverless::Function"
Properties:
FunctionName: TrackingPackageLambda
Handler: trackingPackageHandler.lambda_handler
Runtime: python3.6
CodeUri: ./../../../../pythonScripts-0.0.1.zip
Description: "TrackingPackageLambda"
MemorySize: 128
Timeout: 300
Environment:
Variables:
test: test
PYTHONPATH: "/var/runtime:/var/task/lib"
```
Should parse now in master, but I don't think we can handle ../ in the handler name
Nice, but now I got another error "Cannot find handler 'test.lambda_handler' in project."

using the template.yml from "test" folder
We have fixes for that in a feature branch, should be merged over to master later today / tomorrow.
in this one richali-setSrcRoot ?
Nope, feature/deploy-application
Is it merged right from what I can see? I got the same error even with "feature/deploy-application" merged, and in the logs is not showing errors.
Ya, everything should be in master.
The base of the handler (test in this case) needs to be marked as a source folder, or the codeUri needs to be the full path from the module root, test/test.lambda_handler. We currently don't base the lambda handler off of the template location, for a number of reasons
Still is not working try different ways.
CodeUri: ./../../../python
CodeUri: ./../../python
CodeUri: ./../python
CodeUri: ./python
CodeUri: .
Handler: ./python/trackingPackageHandler.lambda_handler
Handler: trackingPackageHandler.lambda_handler
Handler: ./../python/trackingPackageHandler.lambda_handler
Look this image where I have "src" as "source root."

Those solutions still leverages a handler URI that is relative to a template. We can't support that yet.
You can either:
src/main/python/trackingPackageHandler.lambda_handler. CodeUri would need to be changed to ../../../ to get it to the base.src/main/python/trackingPackageHandler.lambda_handlerOkey that works!
Other question ha, try to debug with breakpoints, but is not working
And every time it uses a random debug port also.
/home/federico/.local/bin/sam local invoke --template "/tmp/[Local] TrackingPackageLambda-template267.yaml" --event "/tmp/[Local] TrackingPackageLambda-event469.json" TrackingPackageLambda --debug-port 35967 --debugger-path /home/federico/.IntelliJIdea2018.2/config/plugins/python/helpers/pydev --debug-args "-u /tmp/lambci_debug_files/pydevd.py --multiprocess --port 35967 --file"
2018-11-19 23:00:32 Invoking src/main/python/test.lambda_handler (python3.6)
2018-11-19 23:00:32 Found credentials in environment variables.
2018-11-19 23:00:32 Decompressing /tmp/8162629067581724954.zip
Fetching lambci/lambda:python3.6 Docker container image......
2018-11-19 23:00:36 Mounting /tmp/tmpY2brDX as /var/task:ro inside runtime container
Connected to pydev debugger (build 182.5107.16)
{"key1": "value1", "key2": "value2", "key3": "value3"}
START RequestId: 1025ebcb-e92d-4cde-8676-0d27f14de1af Version: $LATEST
{'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}
<__main__.LambdaContext object at 0x7ffb346ffeb8>
END RequestId: 1025ebcb-e92d-4cde-8676-0d27f14de1af
REPORT RequestId: 1025ebcb-e92d-4cde-8676-0d27f14de1af Duration: 1 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 27 MB
Debug port doesn't matter. We connect the debugger for you (Connected to pydev debugger (build 182.5107.16)).
Issue is the mappings from local view to the docker view. Since it is failing to breakpoint I can only assume its the Local->Remote mappings not working correctly. We need to add more log statements for that section of code.
I check and there is no log in idea.log when doing debug :(
Maybe could be this mapping "/var/task:ro" like is not "/var/task" from stuff i read in internet..
2018-11-19 23:08:00 Mounting /tmp/tmpnr6XTI as /var/task:ro inside runtime container
Do you want that I open another issue related to this python debug?
The ro just means make it read only.
The issue is toolkit side, not SAM side.
Please cut an issue for the debug, so I can track it separately
I have the exact same problems described in this thread. I am trying to make it work with java Handler and java11 Runtime. I was able to run my Lambda with "/home/linuxbrew/.linuxbrew/bin/sam local invoke --template lambda_template.yaml --event /tmp/extractppfproduct-event.json" executed from intellij terminal i.e. from the maven project root directory. However, the same yaml gives me the error described above: "Error: Cannot find handler 'com.example.LambdaFunctionHandler' in project." I am using 1.9-192. Here is my lambda_template.yaml:
```AWSTemplateFormatVersion: '2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
ExtractPPFProduct:
Type: AWS::Serverless::Function
Properties:
FunctionName: extractppfproduct
Handler: com.example.LambdaFunctionHandler
CodeUri: target/extractppfproduct-1.0.0.jar
Runtime: java11
Timeout: 300
MemorySize: 256
I'm getting the same error as well and assuming what was in master at the time of this post is now released.
My yaml is below.
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Serverless Specification template describing your function.
Resources:
SigCurator:
Type: 'AWS::Serverless::Function'
Properties:
Handler: app.lambda_handler
Runtime: python3.7
CodeUri: .
Description: ''
MemorySize: 1088
Timeout: 300
Role: 'arn:aws:iam::760164410742:role/elasticsearch_process_alerts'
Layers:
- 'arn:aws:lambda:us-east-1:553035198032:layer:git:11'
Any idea what I need to change or if this is related to the bug?
Some logs.
2020-05-01 11:29:15,874 [ 317092] WARN - emetry.DefaultTelemetryBatcher - Failed to publish metrics
java.lang.IllegalStateException: ApplicationManager.getAp鈥se
}
}.get() must not be null
at software.aws.toolkits.jetbrains.services.telemetry.DefaultTelemetryPublisher.publish(DefaultTelemetryPublisher.kt:55)
at software.aws.toolkits.core.telemetry.DefaultTelemetryBatcher.flush(TelemetryBatcher.kt:106)
at software.aws.toolkits.core.telemetry.DefaultTelemetryBatcher.flush(TelemetryBatcher.kt:81)
at software.aws.toolkits.core.telemetry.DefaultTelemetryBatcher.shutdown(TelemetryBatcher.kt:65)
at software.aws.toolkits.jetbrains.services.telemetry.DefaultTelemetryService.dispose(TelemetryService.kt:115)
at com.intellij.openapi.util.ObjectNode.lambda$execute$0(ObjectNode.java:104)
at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:183)
at com.intellij.openapi.util.ObjectNode.execute(ObjectNode.java:71)
at com.intellij.openapi.util.ObjectNode.lambda$execute$0(ObjectNode.java:92)
at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:183)
at com.intellij.openapi.util.ObjectNode.execute(ObjectNode.java:71)
at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:133)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:123)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:119)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$disposeSelf$2(ApplicationImpl.java:180)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:885)
at com.intellij.openapi.application.impl.ApplicationImpl.disposeSelf(ApplicationImpl.java:180)
at com.intellij.openapi.application.impl.ApplicationImpl.doExit(ApplicationImpl.java:655)
at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:628)
at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:617)
at com.intellij.openapi.updateSettings.impl.UpdateInfoDialog.lambda$restartLaterAndRunCommand$2(UpdateInfoDialog.java:286)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:309)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:441)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:908)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:781)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:424)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2020-05-01 11:29:15,891 [ 317109] INFO - org.jetbrains.io.BuiltInServer - web server stopped
2020-05-01 11:29:15,892 [ 317110] INFO - Types.impl.FileTypeManagerImpl - 39 auto-detected files. Detection took 55 ms
2020-05-01 11:29:15,894 [ 317112] INFO - pl.local.NativeFileWatcherImpl - Watcher terminated with exit code 0
2020-05-01 11:29:15,894 [ 317112] INFO - il.indexing.FileBasedIndexImpl - START INDEX SHUTDOWN
2020-05-01 11:29:15,904 [ 317122] INFO - il.indexing.FileBasedIndexImpl - END INDEX SHUTDOWN
2020-05-01 11:29:15,904 [ 317122] INFO - newvfs.persistent.PersistentFS - VFS dispose started
2020-05-01 11:29:15,909 [ 317127] INFO - newvfs.persistent.PersistentFS - VFS dispose completed
2020-05-01 11:29:15,909 [ 317127] INFO - stubs.SerializationManagerImpl - START StubSerializationManager SHUTDOWN
2020-05-01 11:29:15,909 [ 317127] INFO - stubs.SerializationManagerImpl - END StubSerializationManager SHUTDOWN
2020-05-01 11:29:15,917 [ 317135] INFO - #com.intellij.util.Restarter - run restarter: [/Users/michaelschem/Library/Caches/PyCharm2019.3/restart/restarter, /Applications/PyCharm.app, /Users/michaelschem/Library/Caches/PyCharm2019.3/tmp/patch-update/jre/bin/java, -Xmx2000m, -cp, /Users/michaelschem/Library/Caches/PyCharm2019.3/tmp/patch-update/PY-193.6911.25-201.6668.115-patch-jbr11-mac.jar:/Users/michaelschem/Library/Caches/PyCharm2019.3/tmp/patch-update/log4j.jar:/Users/michaelschem/Library/Caches/PyCharm2019.3/tmp/patch-update/jna.jar:/Users/michaelschem/Library/Caches/PyCharm2019.3/tmp/patch-update/jna-platform.jar, -Djna.nosys=true, -Djna.boot.library.path=, -Djna.debug_load=true, -Djna.debug_load.jna=true, -Djava.io.tmpdir=/Users/michaelschem/Library/Caches/PyCharm2019.3/tmp/patch-update, -Didea.updater.log=/Users/michaelschem/Library/Logs/PyCharm2019.3, -Dswing.defaultlaf=com.apple.laf.AquaLookAndFeel, com.intellij.updater.Runner, install, /Applications/PyCharm.app/Contents]
2020-05-01 11:29:15,929 [ 317147] INFO - #com.intellij.idea.Main - ------------------------------------------------------ IDE SHUTDOWN ------------------------------------------------------
2020-05-01 11:29:15,929 [ 317147] INFO - org.jetbrains.io.BuiltInServer - web server stopped
this error msg: Error: Function logical name must be specified. tells nothing
Most helpful comment
I have the exact same problems described in this thread. I am trying to make it work with java Handler and java11 Runtime. I was able to run my Lambda with "/home/linuxbrew/.linuxbrew/bin/sam local invoke --template lambda_template.yaml --event /tmp/extractppfproduct-event.json" executed from intellij terminal i.e. from the maven project root directory. However, the same yaml gives me the error described above: "Error: Cannot find handler 'com.example.LambdaFunctionHandler' in project." I am using 1.9-192. Here is my lambda_template.yaml:
```AWSTemplateFormatVersion: '2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
ExtractPPFProduct:
Type: AWS::Serverless::Function
Properties:
FunctionName: extractppfproduct
Handler: com.example.LambdaFunctionHandler
CodeUri: target/extractppfproduct-1.0.0.jar
Runtime: java11
Timeout: 300
MemorySize: 256