I'm setting up automated tests with AWS Device Farm, and for some reason my upload using the API is just sitting with the Initialized status. It's sending the createUpload() and getting a response with the URL, then sending a request to the URL with the file I want to upload. I'm polling getUpload() every 30 seconds for a change in the status. Here is the main part of my code and the console logs:
https://gist.github.com/asanders-tester/682534925ac314d0805a6dfec547e57f
https://gist.github.com/asanders-tester/40c3e11acd5491aaff7256144f80d8b0
Could anybody provide some insight into what I'm doing wrong? Similar posts here are saying the URL is likely incorrect, but I can't find anything wrong with it.
Cross-posted on AWS Developer Forums: https://forums.aws.amazon.com/thread.jspa?threadID=346232&tstart=0
The upload lifecycle for an upload in AWS Device Farm is that:
It will start in status INITIALIZED
Once your data has been PUT to the presigned URL, it will nearly-immediately enter the status PROCESSING
Shortly-after, the upload will enter a status of SUCCESS or FAILED
It appears that your https request with options is failing to send the data as expected. Can you look into adding an option like "port: 443," to it, as well as printing additional response details when the request is complete?
Related
I'm building a Jira App with Forge where I retrieve board data from the Jira Cloud Rest API. Data retrieval is done in a client-side script using requestJira from #forge/bridge. I'm able to successfully retrieve a list of all boards using the route /rest/agile/1.0/board but when I try to retrieve the configuration of a selected board using the route '/rest/agile/1.0/board/' + boardId + '/configuration' e.g. /rest/agile/1.0/board/4/configuration, this leads to the error response 403 "Forbidden".
In manifest.yml I have defined permissions as follows:
permissions:
scopes:
- read:jira-work
One should think that this should be enough for retrieving board configurations, particularly since the retrieval of the board list was successful. If not, then what is the required permission in this case? Or what else might be going wrong here?
I also tried executing api.asApp().requestJira('/rest/agile/1.0/board/4/configuration',{}) from #forge/api on the server side. Result was the same, i.e. also a 403 response.
The route /rest/agile/1.0/board/4/configuration works fine when pasted into a browser's address field after the URL of my dev instance.
I am running into net::ERR_NAME_NOT_RESOLVED when calling the API of my firebase project. I have tried using multiple devices, two internet connections, a VPN, Linux, macOS, Windows 11 to rule out any errors caused by my devices. When navigating to the API link on my browser it does not timeout, and I am provided with a response. The issue seems to be when using the httpsCallable function provided by Firebase. No logs of the function being called are present on firebase outside of navigating to it in a browser.
Here is my code:
const functions = firebase.functions
console.log(functions)
const loginWithCode = httpsCallable(functions, 'loginWithCode')
loginWithCode(loginPayload)
.then((result) => {
console.log(result)
})
.catch((error) => {
console.log("ERROR CAUGHT HERE")
console.log(error)
});
The output from my browser console:
service.ts:206 POST https://us-central1-%22crowd-pleaser-75fd7%22%2C.cloudfunctions.net/loginWithCode net::ERR_NAME_NOT_RESOLVED
App.tsx:79 ERROR CAUGHT HERE
App.tsx:80 FirebaseError: internal
The result from directly inputting the link on the firebase web interface:
{"error":{"message":"Bad Request","status":"INVALID_ARGUMENT"}}
Is there something I am missing that is creating this issue? I have scoured the internet, and StackOverflow looking for an answer, and all solutions provided have not worked. The method implemented is exactly how it is done on the Firebase docs here
Edit: It seems like the link to which my post request is being sent is formatted oddly. Maybe this could be the issue? I can't figure out why it's formatted this way though.
I found a solution to the problem. My speculation in my edit was correct, the URL to which the post request was being sent by httpsCallable was formatted incorrectly. I am unsure as to why it was being formatted this way, however, the quick solution is to set the customDomain class attribute of the object returned by getFunctions to the correct domain. In my case this was done by doing:
functions.customDomain = functions.customDomain = 'https://us-central1-crowd-pleaser-75fd7.cloudfunctions.net'
The variable 'functions' in the code above is the class attribute returned from the method getFunctions provided by Firebase
The Thing
While I'm not an expert on Firebase the problem is that you're making a wrong HTTP request with loginWithCode(loginPayload), there is nothing wrong with your code that I can see at least.
By the way, you're using:
const loginWithCode = httpsCallable(functions, 'loginWithCode')
rather than a simple const loginWithCode = httpsCallable('addMessage')
as described here: Google FireBase Docs
And then, making a loginWithCode({ text: messageText })
Also, as you can see here: Google Firebase Docs:firebase.functions.HttpsCallable
You will be able to pass any type of data to the HttpsCallable function, so we end at the start point: you're making a wrong HTTP request.
As described in the HTTP answer the error is: net::ERR_NAME_NOT_RESOLVED this happens when a DNS request cannot be resolved, then a domain doesn't exists so this all leads to the thing that there is no way to send the HTTP request since there is not a route in the internet that was found to send it.
The Problem:
While decoding the url that you're making the HTTP request
service.ts:206 POST https://us-central1-%22crowd-pleaser-75fd7%22%2C.cloudfunctions.net/loginWithCode net::ERR_NAME_NOT_RESOLVED
App.tsx:79 ERROR CAUGHT HERE
App.tsx:80 FirebaseError: internal
You will find that you're sending the HTTP request to:
https://us-central1-"crowd-pleaser-75fd7",.cloudfunctions.net/loginWithCode
As you can see, you will find that when making the HTTP request it will be a problem: since you cannot put "crowd-pleaser-75fd7", in the URL to make the HTTP request. That is generating the error net::ERR_NAME_NOT_RESOLVED
I'm not sure what exactly are you trying to do, but I think that the correct URL to the HTTP request should be:
https://us-central1-crowd-pleaser-75fd7.cloudfunctions.net/loginWithCode
With this URL the HTTP request must pass, at least. And I suggest then check the loginPayload in order to fix this.
I am trying to receive Shopify webhooks in Google App Script and can do so, but Shopify requires a response in 5 seconds. If it doesn't get a response "200 OK" it will fire again and again until Shopify deletes your webhook. Not good for me...
I got my webhook deleted with the below code:
function doPost(e) {
//Do stuff (code note included)
return ContentService.createTextOutput('200 OK');
}
I suppose there could be 2 problems
The code is wrong.
The code takes longer than 5 seconds to execute or fails
I wish Shopify would give more info on webhook history so I could see if it's not getting a response. Any insights of how I can solve this problem.
Any ideas on how to solve this?
You state in your question that you do receive the webhook. The usual best practice is to verify the authenticity, and once that passes, you have the data (usually json). At that point, DO NOTHING but save the data for processing later, and return 200 OK as your response to the webhook.
DO NOT process the webhook, and then return 200 OK. The reason is quite simple. If your processing takes time, you kill your response back to Shopify in a timely manner.
A background job to process the data is ideal.
I am using Javascript API to upload documents to Amazon S3, and I want to handle cases where the upload to s3 is aborted. May be user closes the browser tab or refresh the page (mainly closing of the browser tab)
Is there a way i can handle the case where i can send a request to my server side code when user aborts s3.upload.
I have the below code
let s3Upload = s3.upload(params).on('httpUploadProgress', function(evt) {
jQuery('.export-progress').html("Progress: "+ evt.loaded + "/" + evt.total);
}).promise();
s3Upload.then(function(s3data){
//success processing
}, function(err){
// any error
});
Any help in this would be really great. Many thanks.
Is there a way i can handle the case where i can send a request to my server side code when user aborts s3.upload.
Not really. The Beacon API can be used to fire off a request if the user closes a tab, but what about cases where their battery dies, browser crashes, computer gets rebooted, etc.?
I usually handle this in one of two ways:
Configure a notification when objects are added, so you can associate the data.
On upload success (at the client), do a post back to your API to notify it that it succeeded.
Note that both methods are subject to failure, so you should have a cron job or something that regularly sweeps up unexpected items in your bucket, if appropriate for your use case.
Is there a way to track delivery report of a particular message that have been sent via FCM to android device, i found we can add delivery_receipt_requested to track delivery and i have added that my json data as follows,
{"to":"KEY",
"data":{
"data":{
"title":"test message",
"message":"sent",
"image":null}
},
"notification":{
"delivery_receipt_requested":true
}
}
and i receive a response
{"multicast_id":6417448921485349071,"success":1,"failure":0,"canonical_ids":0,"results":[{"error":"false"}]}
In php or javascript i need something like if we pass that multicast_id need to get the current status of the text. I found it was almost nightmare to get the desired result, but its not impossible is there anyway guys?
There is currently no way to manually ask the FCM server about the status of the sent message.
Based from your post, it seems you already did your homework on checking the FCM service. Implementing the delivery receipts is the only way (AFAIK) that you could attain the behavior you mentioned in your post.
Implementing the delivery receipt not only needs the delivery_receipt_requested parameter in your payload, you have to implement an XMPP server protocol as well. Along with the Upstream Messaging part on your client app (for the acknowledgement part).