Apportable Xcode 5 empty project compile error - apportable

i have an created an empty project in xcode 5. It gave me this error when I did apportable build
'androidshark apple$ apportable load
Building with TARGET_ARCH_ABI:armeabi ARM_NEON:False
Building to /Users/apple/.apportable/SDK/Build/android-armeabi-debug
Updating configuration parameters... Building Xcode project /android/shark2/androidshark/androidshark
Scanning build configuration for target androidshark
2013-09-27 13:18:38.657 xcodebuild[83681:313] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from /var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-fiixcbwreansxzhkosqdeekvvhit/androidshark-Prefix.pch.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “androidshark-Prefix.pch.d” couldn’t be opened because there is no such file." UserInfo=0x7fbabd831650 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-fiixcbwreansxzhkosqdeekvvhit/androidshark-Prefix.pch.d, NSUnderlyingError=0x7fbabd87f080 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-fiixcbwreansxzhkosqdeekvvhit/androidshark-Prefix.pch.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7fbabd8c0a30>{name = (null), num = 6}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:38.699 xcodebuild[83681:4403] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpa1EIp5/TARGET_TEMP_DIR/Objects-normal/armv7/sharkAppDelegate.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “sharkAppDelegate.d” couldn’t be opened because there is no such file." UserInfo=0x7fbabd9be8a0 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpa1EIp5/TARGET_TEMP_DIR/Objects-normal/armv7/sharkAppDelegate.d, NSUnderlyingError=0x7fbabd9bd520 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpa1EIp5/TARGET_TEMP_DIR/Objects-normal/armv7/sharkAppDelegate.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *strong, F) [F = ]
Thread: {name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:38.745 xcodebuild[83681:232b] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from /var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpa1EIp5/TARGET_TEMP_DIR/Objects-normal/armv7/main.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “main.d” couldn’t be opened because there is no such file." UserInfo=0x7fbabda275e0 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpa1EIp5/TARGET_TEMP_DIR/Objects-normal/armv7/main.d, NSUnderlyingError=0x7fbabda24bf0 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpa1EIp5/TARGET_TEMP_DIR/Objects-normal/armv7/main.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7fbabda25cc0>{name = (null), num = 8}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
Scanning build configuration for target androidsharkTests
2013-09-27 13:18:42.845 xcodebuild[83701:2813] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-fofkyioslmjpdibzwybriufsgphs/androidshark-Prefix.pch.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “androidshark-Prefix.pch.d” couldn’t be opened because there is no such file." UserInfo=0x7fd1941b5760 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-fofkyioslmjpdibzwybriufsgphs/androidshark-Prefix.pch.d, NSUnderlyingError=0x7fd1941b60f0 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-fofkyioslmjpdibzwybriufsgphs/androidshark-Prefix.pch.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = ]
Thread: {name = (null), num = 6}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:42.887 xcodebuild[83701:2813] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from /var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/sharkAppDelegate.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “sharkAppDelegate.d” couldn’t be opened because there is no such file." UserInfo=0x7fd1941bec80 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/sharkAppDelegate.d, NSUnderlyingError=0x7fd1941b4a00 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/sharkAppDelegate.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7fd1941ebf10>{name = (null), num = 6}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:42.922 xcodebuild[83701:1703] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/main.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “main.d” couldn’t be opened because there is no such file." UserInfo=0x7fd1941f5a30 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/main.d, NSUnderlyingError=0x7fd1941f59a0 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/main.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = ]
Thread: {name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:43.116 xcodebuild[83701:1703] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from /var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-gbnbvpzwmdufkrfybjovaydtncti/androidshark-Prefix.pch.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “androidshark-Prefix.pch.d” couldn’t be opened because there is no such file." UserInfo=0x7fd1941b6650 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-gbnbvpzwmdufkrfybjovaydtncti/androidshark-Prefix.pch.d, NSUnderlyingError=0x7fd1936c0d40 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/C/com.apple.DeveloperTools/5.0-5A1412/Xcode/SharedPrecompiledHeaders/androidshark-Prefix-gbnbvpzwmdufkrfybjovaydtncti/androidshark-Prefix.pch.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7fd1941b4a00>{name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:43.158 xcodebuild[83701:1703] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3564/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/androidsharkTests.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “androidsharkTests.d” couldn’t be opened because there is no such file." UserInfo=0x7fd1941b5050 {NSFilePath=/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/androidsharkTests.d, NSUnderlyingError=0x7fd1941bc7c0 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/var/folders/nc/m2ds8dw113l80bkf79bcfqg40000gn/T/tmpLcA0vT/TARGET_TEMP_DIR/Objects-normal/armv7/androidsharkTests.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = ]
Thread: {name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2013-09-27 13:18:43,231 - build - ERROR - Could not generate build parameters
Traceback (most recent call last):
File "/Users/apple/.apportable/SDK/site_scons/build/__init.py", line 481, in App
generated, generated_path, main_module = xcode.GenerateBuildParams(env)
File "/Users/apple/.apportable/SDK/site_scons/build/xcode.py", line 140, in GenerateBuildParams
for lib in selected_target_generated['libs']:
TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/Users/apple/.apportable/SDK/bin/apportable", line 782, in
run(env)
File "/Users/apple/.apportable/SDK/bin/apportable", line 723, in run
results = actionsargs.action
File "/Users/apple/.apportable/SDK/bin/apportable", line 86, in LoadAction
return env.LoadApp(site_init.BuildApplication(env, env['BUILD_TARGET']))
File "/Users/apple/.apportable/SDK/site_scons/site_init.py", line 388, in BuildApplication
return build.App(env, app_sconscript)
File "/Users/apple/.apportable/SDK/site_scons/build/init.py", line 481, in App
generated, generated_path, main_module = xcode.GenerateBuildParams(env)
File "/Users/apple/.apportable/SDK/site_scons/build/xcode.py", line 140, in GenerateBuildParams
for lib in selected_target_generated['libs']:
TypeError: 'NoneType' object is not subscriptable'

As Philippe Hausler said in their support forum
We are working on a fix still, hopefully it should be ready by next week.
I personally have my Xcode 4 stored at /Applications/Xcode4.app and Xcode 5 stored at /Applications/Xcode5.app
to build with current stuff I have to switch via this:
sudo xcode-select --switch /Applications/Xcode4.app/Contents/Developer
Here is forum URL https://groups.google.com/forum/#!forum/apportable-discuss worth to check on a daily basis.
Cheers,
Hubert

I forgot to add that I tried an empty project because I got very similar errors with my other projects, which got even bigger error list.
I got the latest version 1.024
I got stuff to compile before with Xcode 4.61 before. I don't know what happned now.

The 1.0.26 SDK, released today, has initial support for Xcode 5.
Run apportable update to update your installation.

Related

Error on android studio : "opening kernel wakelock stats for: wakeup35: Permission denied "

I keep getting errors about pipe fail and permission denied when I try to run mu code on Android Studio. Does anyone know how to fix this problem?
"
2023-02-19 14:36:13.517 483-483/? E/netmgr: qemu_pipe_open_ns:62: Could not connect to the 'pipe:qemud:network' service: Invalid argument
2023-02-19 14:36:13.519 483-483/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2023-02-19 14:36:18.559 485-485/? E/wifi_forwarder: qemu_pipe_open_ns:62: Could not connect to the 'pipe:qemud:wififorward' service: Invalid argument
2023-02-19 14:36:18.560 485-485/? E/wifi_forwarder: RemoteConnection failed to initialize: RemoteConnection failed to open pipe
"
"
2023-02-19 14:34:13.500 483-483/? E/netmgr: qemu_pipe_open_ns:62: Could not connect to the 'pipe:qemud:network' service: Invalid argument
2023-02-19 14:34:13.501 483-483/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2023-02-19 14:34:18.497 485-485/? E/wifi_forwarder: qemu_pipe_open_ns:62: Could not connect to the 'pipe:qemud:wififorward' service: Invalid argument
2023-02-19 14:34:18.497 485-485/? E/wifi_forwarder: RemoteConnection failed to initialize: RemoteConnection failed to open pipe
"

Rust-analyzer in VSCode to substitute env variables in Cargo path imports

I have a Cargo workspace and want to use a WORKSPACE_HOME environment variable in the import path of local crates.
For instance: in $WORKSPACE_HOME/services/api/Cargo.toml
[dependencies]
...
addrbook = { path = "${WORKSPACE_HOME}/pkg/addrbook" }
...
I tried adding the environment value to VSCode settings.json (under rust-analyzer.cargo.extraEnv) and also tried creating a .cargo/config.toml as described here
[env]
WORKSPACE_HOME = { value = "", relative = true }
Unfortunately, cargo metadata keeps failing saying that it is unable to resolve the path
[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /Users/nickdecooman/Documents/Workspace/foobar/Cargo.toml, Some(Version { major: 1, minor: 63, patch: 0 }): Failed to run `"cargo" "metadata" "--format-version" "1" "--manifest-path" "/Users/nickdecooman/Documents/Workspace/foobar/Cargo.toml" "--filter-platform" "x86_64-apple-darwin"`: `cargo metadata` exited with an error: error: failed to load manifest for workspace member `/Users/nickdecooman/Documents/Workspace/foobar/services/api`
Caused by:
failed to load manifest for dependency `addrbook`
Caused by:
failed to read `/Users/nickdecooman/Documents/Workspace/foobar/services/api/${WORKSPACE_HOME}/pkg/addrbook/Cargo.toml`
Caused by:
No such file or directory (os error 2)

Failed to flush task queue within 120 seconds on Automatic ML

I'm running a Automatic ML on Azure but it fails and this is the error the child jobs are giving me.
Starting the automl_batch_driver setup...
Set enable_streaming flag to False
Batch Run Id in the real script: AutoML_11f87010-f7b0-4819-aecb-ad6b31f2469a_worker_11
2022-06-07 17:46:03,026817 - INFO - Beginning batch driver wrapper.
2022-06-07 17:46:03.297 - INFO - Successfully got the cache data store, caching enabled.
2022-06-07 17:46:03.297 - INFO - Took 0.13631367683410645 seconds to retrieve cache data store
2022-06-07 17:46:03.306 - INFO - No files are available for the cache store locally, downloading files from the Run.
2022-06-07 17:48:04.348 - ERROR - Type: {'code': 'ResourceExhausted', 'inner_error': {'code': 'Timeout'}}
Class: AzureMLException
Message: AzureMLException:
Message: Failed to flush task queue within 120 seconds
InnerException None
ErrorResponse
{
"error": {
"code": "UserError",
"message": "Failed to flush task queue within 120 seconds",
"inner_error": {
"code": "ResourceExhausted",
"inner_error": {
"code": "Timeout"
}
}
}
}

How to resolve 'Invalid PKCS8 header error' in AWS lambda

I am trying to perform jwt.encode on a small request message with a private key that I am retrieving from DynamoDB. My work station is Mac OS.
The code works in my local environment but failed when I tried to execute it in AWS lambda python3.7 environment. Any suggestions on how to solve this issue?
{
"errorMessage": "Invalid PKCS8 header",
"errorType": "JWSError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 228, in lambda_handler\n response = send_request(url, body=body)\n",
" File \"/var/task/lambda_function.py\", line 67, in send_request\n token = _gen_jwt(private_key)\n",
" File \"/var/task/lambda_function.py\", line 52, in _gen_jwt\n token = jwt.encode(payload, private_key, algorithm='RS256', headers=headers)\n",
" File \"/var/task/jose/jwt.py\", line 61, in encode\n return jws.sign(claims, key, headers=headers, algorithm=algorithm)\n",
" File \"/var/task/jose/jws.py\", line 47, in sign\n signed_output = _sign_header_and_claims(encoded_header, encoded_payload, algorithm, key)\n",
" File \"/var/task/jose/jws.py\", line 168, in _sign_header_and_claims\n raise JWSError(e)\n"
]
}
This issue was resolved after I rebuild my lambda package within a Linux environment and redeploy to AWS Lambda.
I created a docker image from python3.7.4 and deploy the package to lambda from within the container.
This solution also solves the issue:
ImportError: /var/task/cryptography/hazmat/bindings/_constant_time.so: invalid ELF header
According to https://github.com/pyca/cryptography/issues/3051

How do I get an authorized user for PostText API call for a Lex bot runtime

Sorry for the long post. I am trying to call a Lex bot with the PostText runtime API with my lambda function. However when I test this call then it returns that the userID is not authorized to use this. This is the error message I receive:
Response:
{
"errorMessage": "An error occurred (AccessDeniedException) when calling the PostText operation: User: arn:aws:sts::981709171824:assumed-role/lambda_basic_execution/OrchestratorAPIApp is not authorized to perform: lex:PostText on resource: arn:aws:lex:us-east-1:981709171824:bot:SupportBot_BookCab:SupportBot_BookCab",
"errorType": "ClientError",
"stackTrace": [
[
"/var/task/lambda_function.py",
18,
"lambda_handler",
"inputText= userInput"
],
[
"/var/runtime/botocore/client.py",
314,
"_api_call",
"return self._make_api_call(operation_name, kwargs)"
],
[
"/var/runtime/botocore/client.py",
612,
"_make_api_call",
"raise error_class(parsed_response, operation_name)"
]
]
}
Request ID:
"677f1820-6ed2-11e8-b891-33ab1951c65f"
Function Logs:
START RequestId: 677f1820-6ed2-11e8-b891-33ab1951c65f Version: $LATEST
An error occurred (AccessDeniedException) when calling the PostText operation: User: arn:aws:sts::981709171824:assumed-role/lambda_basic_execution/OrchestratorAPIApp is not authorized to perform: lex:PostText on resource: arn:aws:lex:us-east-1:981709171824:bot:SupportBot_BookCab:SupportBot_BookCab: ClientError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 18, in lambda_handler
inputText= userInput
File "/var/runtime/botocore/client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/var/runtime/botocore/client.py", line 612, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDeniedException) when calling the PostText operation: User: arn:aws:sts::981709171824:assumed-role/lambda_basic_execution/OrchestratorAPIApp is not authorized to perform: lex:PostText on resource: arn:aws:lex:us-east-1:981709171824:bot:SupportBot_BookCab:SupportBot_BookCab
END RequestId: 677f1820-6ed2-11e8-b891-33ab1951c65f
REPORT RequestId: 677f1820-6ed2-11e8-b891-33ab1951c65f Duration: 325.25 ms Billed Duration: 400 ms Memory Size: 128 MB Max Memory Used: 31 MB
This is my code to calling the API:
import boto3
def lambda_handler(event, context):
responderName = event["DestinationBot"]
userId = event["RecipientID"]
userInput = event["message"]["text"]
client = boto3.client('lex-runtime')
response = client.post_text(
botName=responderName,
botAlias=responderName,
userId=userId,
sessionAttributes={
},
requestAttributes={
},
inputText= userInput
)
This is my sample test input:
{
"DestinationBot": "SupportBot_BookCab",
"RecipientID": "12345",
"message": {
"text": "book me a cab"
}
}
The userID of PostText is the way you persist the conversation back and forth between the user and Lex. It can be anything that you can identify the user by in their incoming request that is consistent and unique to them, at least for that session.
From AWS PostText Docs:
userID
The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot. At runtime, each request must contain the userID field.
...
Length Constraints: Minimum length of 2. Maximum length of 100.
Pattern: [0-9a-zA-Z._:-]+
So if a user is using Facebook messenger, they will have a Facebook ID that is passed with their messages and you can use that as their userID.
If a user is using Twilio-SMS, they will have a phone number passed with their messages and you can use that as their userID.
Your code is currently taking event["RecipientID"] and using that as a userID. But the RecipientID from an incoming message is yourself, the receiver of the incoming message.
Your error is telling you that
... User: arn:aws:sts::XXXXXXXXXX:assumed-role/lambda_basic_execution/OrchestratorAPIApp
So the userID = event["RecipientID"] = 'arn:aws:sts::XXXXXXXX:assumed-role/lambda_basic_execution/OrchestratorAPIApp'
You definitely don't want the Recipient ID to be used.
Instead you want the sender's ID to be the userID. Something like:
userId = event["SenderID"]
That might not be the exact code you use, its just an example. You should be able to view the incoming request, and locate something in there to use as a proper userID as I explained above with Facebook and Twilio.

Resources