using (var file = await CrossMedia.Current.TakePhotoAsync(options))
{
.....
}
I am using cross media for take photo in xamarin forms ios(Above code). I am getting this error in app center,
System.IO.DirectoryNotFoundException: Could not find a part of the path "/var/mobile/Containers/Data/Application/D9CD5B7E-D0AD-41A1-97DA-9B6FC4471955/Documents/myapp/2266603_21-1-2021-12-0-21-4152..jpg"
How to resolve this error?
Error Message:
{
"length": 0,
"offset": 0,
"id": "4be55b3c-33f1-4bbf-99a3-b4af8203a0ba",
"exception": {
"type": "System.IO.DirectoryNotFoundException",
"message": "Could not find a part of the path \"/var/mobile/Containers/Data/Application/D9CD5B7E-D0AD-41A1-97DA-9B6FC4471955/Documents/myapp/2266603_21-1-2021-12-1-19-8643..jpg\".",
"stackTrace": " at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) <0x102720700 + 0x00214> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 \n at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) <0x102720650 + 0x0008f> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 \n at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access) <0x102720420 + 0x0006f> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 ",
"wrapperSdkName": "appcenter.xamarin"
},
"properties": {
"message:": "Could not find a part of the path \"/var/mobile/Containers/Data/Application/D9CD5B7E-D0AD-41A1-97DA-9B6FC4471955/Documents/myapp/2266603_21-1-2021-12-1-19-8643..jpg\".",
},
"appId": "5993bbda-3072-45e5-9418-a260aa66a94f",
"installId": "761843BC-C04F-4E62-A3EB-C636C58CEFF7",
"isTestMessage": false,
"timestamp": "2021-02-03T03:44:15.833Z",
"sid": "5e3c4238-d2cc-42da-8ab4-319d4c97b21a",
"device": {
"sdkName": "appcenter.ios",
"sdkVersion": "4.0.0",
"wrapperSdkVersion": "4.0.0",
"wrapperSdkName": "appcenter.xamarin",
"model": "iPad7,5",
"oemName": "Apple",
"osName": "iOS",
"osVersion": "14.3",
"osBuild": "18C66",
"locale": "en_AE",
"timeZoneOffset": 240,
"screenSize": "2048x1536",
"appVersion": "3.1.1",
"appBuild": "3.9",
"appNamespace": "com.myapp",
"wrapperRuntimeVersion": "12.6.0"
}
}
Assuming that you have posted all the relevant code and that you can reproduce the error with it, then the exception happens in the plug-in. As such you need to submit the issue to the plug-in authors so that they can resolve it.
For some reason you are looking for this file
myapp/2266603_21-1-2021-12-1-19-8643..jpg.
Notice how there are two ".."?
You should fix your code so it tries to reference myapp/2266603_21-1-2021-12-1-19-8643.jpg instead!
Related
I'm using WebSocket to execute my code in JuputerHub.
Sometimes, the kernel crashes.
On the JupyterHub screen, it pops up and dies.
At this time, I was trying to find out what is received by the WebSocket client.
I found that the following message was received.
{
"header":
{
"msg_id": "22c8998f-d7e10c7f402c9277feae8936_2",
"msg_type": "status",
"username": "username",
"session": "22c8998f-d7e10c7f402c9277feae8936",
"date": "2022-01-20T00:44:38.498534Z",
"version": "5.3"
},
"msg_id": "22c8998f-d7e10c7f402c9277feae8936_2",
"msg_type": "status",
"parent_header": {},
"content":
{
"execution_state": "restarting"
},
"metadata": {},
"channel": "iopub"
}
Noted.
"execution_state": "restarting"
This execution_state is the one I used in the previous example. As far as I can tell, this execution_state is not sent in any other case.
When the kernel crashes, "execution_state": "restarting" is sent.
Is this a JupyterHub specification?
https://jupyter-client.readthedocs.io/en/stable/messaging.html
I also read , but I couldn't find such a description.
I have created a state machine with AWD CDK (typescript) and it all works fine. It is just the output of Lambda 1 which is the input for Lambda 2, has some sort of state machine padding which I am not interested in.
Definition of state machine:
{
"StartAt": "",
"States": {
"...applicationPdf": {
"Next": "...setApplicationProcessed",
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "...applicationPdf",
"Payload.$": "$"
}
},
"...setApplicationProcessed": {
"Next": "Done",
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"...applicationPdf",
"Payload.$": "$"
}
},
"Done": {
"Type": "Succeed"
}
}
}
Output of Lambda1 (applicationPdf):
{
"ExecutedVersion": "$LATEST",
"Payload": {
...
},
"SdkHttpMetadata": {
"AllHttpHeaders": {
...
},
"HttpHeaders": {
....
},
"HttpStatusCode": 200
},
"SdkResponseMetadata": {
....
},
"StatusCode": 200
}
So I am only interested in Payload, not all the other stuff.
The reason I want to do is that is I want to run the 2nd lambda separately I just want the Event going into the Lambda, to be the Payload object, not the the object with ExecutedVersion etc.
Does anyone know how to do this?
I will have a look at the Parameters option of the definition, maybe the answer lies there.
Thanks for your question and for your interest in Step Functions.
The ResultSelector and OutputPath fields can be used to manipulate the output of a state, which can be particularly helpful when a state outputs values which you do not need access to in subsequent states. The difference between them is that ResultSelector is applied before the state's ResultPath is applied, while OutputPath is applied after it.
As you noted, you can use OutputPath to filter out any unwanted metadata before being passed on to the next state.
I found one solution, add the outputPath:
return new LambdaInvoke(this, 'lamba', {
lambdaFunction: Function.fromFunctionArn(this, name, this.createLabmdaArn('applicationPdf')),
outputPath: '$.Payload',
});
This seems to work and might be THE solution.
I am trying to dynamically populate a message menu based on user selection. however, i am not sure how to send response to slack with the dynamic options. is it through chat.postMessage or chat.update? I tried both and it did not work. this is my code:
function usr_access (actionName,response_URL) {
var message = {
"text": "Choose the folder which you need access to",
"replace_original": false,
"attachments": [
{
"fallback": "Ooops... something went wrong..",
"callback_id": "DAaccess",
"attachment-type": "default",
"actions": [
{
"name": "fld_list",
"text": "Select",
"type": "select",
"data_source": "external"
}
]
}
]
}
sendMessageToSlackResponseURL(response_URL, message)
}
I am receiving below error:
request
="{\"name\":\"fld_list\",\"value\":\"\",\"callback_id\":\"DAaccess\",\"type\":\"interactive_message\",\"team\":{\"id\":\"xxxxxxxx\",\"domain\":\"xxxxxxxxx\"},\"channel\":{\"id\":\"XXXXXXXX\",\"name\":\"directmessage\"},\"user\":{\"id\":\"xxxxxxxx\",\"name\":\"xxxxxxxxxxxxxx\"},\"action_ts\":\"1545655305.281796\",\"message_ts\":\"1545654125.002700\",\"attachment_id\":\"1\",\"token\":\"xxxxxxxxxxxxxxxx\"}" request =interactive_message ReferenceError: res is not defined
at Request.request [as _callback] (SlackApp/events_slack.js:130:12)
at self.callback (SlackApp/node_modules/request/request.js:185:22)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at Request.init (SlackApp/node_modules/request/request.js:231:17)
at new Request (SlackApp/node_modules/request/request.js:127:8)
at request (SlackApp/node_modules/request/index.js:53:10)
at sendDynamicList (SlackApp/events_slack.js:128:2)
at app.post (SlackApp/events_slack.js:651:7)
any help or direction would be really appreciated.
Issue is resolved now. I tried sending the options is JSON format through res.send() function.(didn't think we can send options that way).
In my logs I find
START RequestId: 123a1a12-1234-1234-1234-123456789012 Version: $LATEST
for every invocation of AWS lambda. Is it possible to get more information about a request, e.g. what triggered it?
You can get the request id and other information from the context object.
When Lambda runs your function, it passes a context object to the handler. This object provides methods and properties that provide information about the invocation, function, and execution environment.
https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html
You can get further information from the process.env variable.
I wrote a short lambda function (node.js) which logs these information to the console and ends up in aws cloud watch
exports.handler = async (event, context) => {
console.log('context:', JSON.stringify(context));
console.log('process.env:', JSON.stringify(process.env));
return {statusCode: 200, body: 'Hello World'};
};
Log output:
START RequestId: 6f3c103e-f0a5-4982-934c-dabedda0065e Version: $LATEST
context:
{
"callbackWaitsForEmptyEventLoop": true,
"functionVersion": "$LATEST",
"functionName": "my_lambda_function_name",
"memoryLimitInMB": "128",
"logGroupName": "/aws/lambda/my_lambda_function_name",
"logStreamName": "2020/10/01/[$LATEST]8adb13668eed4ac8b3e7f8d796fe4d49",
"invokedFunctionArn": "arn:aws:lambda:us-east-1:636121343751:function:my_lambda_function_name",
"awsRequestId": "6f3c103e-f0a5-4982-934c-dabedda0065e"
}
process.env:
{
"AWS_LAMBDA_FUNCTION_VERSION": "$LATEST",
"AWS_SESSION_TOKEN": "IZZ3eS6vFF...",
"LD_LIBRARY_PATH": "/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib",
"LAMBDA_TASK_ROOT": "/var/task",
"AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/my_lambda_function_name",
"AWS_LAMBDA_RUNTIME_API": "127.0.0.1:9001",
"AWS_LAMBDA_LOG_STREAM_NAME": "2020/10/01/[$LATEST]8adb13668eed4ac8b3e7f8d796fe4d49",
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs12.x",
"AWS_LAMBDA_FUNCTION_NAME": "my_lambda_function_name",
"AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2:2000",
"PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin",
"AWS_DEFAULT_REGION": "us-east-1",
"PWD": "/var/task",
"AWS_SECRET_ACCESS_KEY": "5nQrpKhBwF...",
"LAMBDA_RUNTIME_DIR": "/var/runtime",
"LANG": "en_US.UTF-8",
"NODE_PATH": "/opt/nodejs/node12/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules:/var/runtime:/var/task",
"AWS_REGION": "us-east-1",
"TZ": ":UTC",
"AWS_ACCESS_KEY_ID": "ASIAZNANWY3473BTADSB",
"SHLVL": "0",
"_AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2",
"_AWS_XRAY_DAEMON_PORT": "2000",
"AWS_XRAY_CONTEXT_MISSING": "LOG_ERROR",
"_HANDLER": "index.handler",
"AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "128",
"_X_AMZN_TRACE_ID": "Root=1-6f75f4e5-5801599f17fd63e74ecd0833;Parent=73fb93812cdbf83f;Sampled=0"
}
END RequestId: 6f3c103e-f0a5-4982-934c-dabedda0065e
REPORT RequestId: 6f3c103e-f0a5-4982-934c-dabedda0065e
Duration: 21.71 ms Billed Duration: 100 ms
Memory Size: 128 MB Max Memory Used: 64 MB Init Duration: 132.35 ms
Not sure I understand what you mean by what triggered it? If it's connected to the API Gateway, then requests are proxied through the Gateway to your Lambda. In that case the Gateway triggered it, even though it was a proxied request.
Additionally and you can augment your Gateway to pass additional request info to your Lambda. See how
And also, to attach the request details to the RequestID you're seeing, you can check the context.awsRequestId.
I'd assume you want to do some form of log monitoring, in which case I think you can bundle up these request information(headers, query, params, body) and send to your log aggregator along with the awsRequestId.
Let me know if that helps
Further reference
A lambda function has two parameters: Event and context.
A normal invocation looks like this:
{
"event": {
"version": "0",
"id": "abcdefgh-1234-5678-1234-abcdefghijkl",
"detail-type": "Scheduled Event",
"source": "aws.events",
"account": "123456789012",
"time": "2018-01-01T12:00:00Z",
"region": "us-east-1",
"resources": [
"arn:aws:events:us-east-1:123456788901:rule/foo"
],
"detail": {}
},
"context": "<__main__.LambdaContext object at 0x123456ax1234>"
}
The test invocation has the elements you get.
You need to get this information from your lambda function context .
RequestId=context.aws_request_id
You will get following result
RequestId- "00cfaafe-5018-4be0-9668-b98daf5a7312" Version: $LATEST
I'm writing a Chrome extension which performs a simple ajax call (based on this example from the docs):
$.ajax({
type: "GET",
url: "http://www.flags.99k.org/getFlags.php"
}).done(function(response) {
alert("SUCCESS: " + response);
}).fail(function(response) {
alert("FAILURE: " + response);
});
The request always fails, because the alert shows: FAILURE: [object Object].
The URL is valid: When I put http://www.flags.99k.org/getFlags.php in my address bar, I get this:
[{"UID": "1", "Message": "Hello"}, {"UID": "2", "Message": "World"}, {"UID": "3", "Message": "Hello World"}]
Here is my manifest.json for the extension.
{
"name": "Hello World",
"version": "1.0",
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"http://www.flags.99k.org/"
]
}
I use Chromium 17.0.963.79 (Developer Build 125985 Linux) Ubuntu 11.10.
Currently, only the root directory is allowed to be accessed, via the permissions in the manifest. You have to add a wildcard after the URI to the permissions:
"permissions": [
"http://www.flags.99k.org/*"
]
See also: Match patterns.
EDIT: The updated code did not work, because http://www.flags.99k.org/ redirects to http://flags.99k.org/ (without www). So, also whitelist this location:
"permissions": [
"http://flags.99k.org/*",
"http://www.flags.99k.org/*"
]
Instead of doing...
alert("FAILURE: " + response);
...do...
console.debug('FAILURE');
console.debug(response);
Then if you go to the console (ctrl-shift-j on windows) you'll see an object that you can expand to see all its properties and what not, that can really help. Plus have you looked at the console when doing the request? You might get some error messages there.
This could be a cross domain issue.
When you enter the URL into your address bar it works because it's being delivered to your browser from the host.
Because you are attempting to hit a full URL outside of your hosted domain - you may need to use JSONP.