PWA share target - manifest is not refreshing - share

At first version of my pwa app I created manifest including share target
"share_target": {
"action": "/product/new",
"method": "GET",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
},
Everything was fine.
Now I decided to handle POST action instead of GET, so I changed share_target like this:
...
"share_target": {
"action": "/product/share",
"method": "POST",
"enctype": "multipart/form-data",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
},
...
Changed method, action and added enctype.
It seems like nothing changed. Sharing still calls old method /product/new (checked in backend logs, /product/share never called). Of course when I go directly to /manifest.json via browser, there is a new version of manifest.
I reinstalled my app, clear chrome cache. Nothing changed.
Do you have any idea how force it to refresh?

In general to get manifest.json file updates your users have to uninstall and reinstall the app. Some sites are installed with WebAPKs and are the exception, they will generally check for updates every 24 hours.

Related

Flutter web custom domain site not found error

I deployed my flutter app on a custom domain but when I try to acces the domain I get the firebase site not found page
this is what I get when I put in my url
when I go to the domain firebase gives you the page loads just like normal and also when I turn on a vpn the page loads on the custom domain. the page also loads like normal if I put something behind the / of the url so I will do "app.domain.com/(any random word works so home or random etc.)" and it will redirect me to the homepage.
when I enter the url with something behind the /
I have tried loading the page on multiple devices and browsers, deleting the cookies and cache of used browsers, used incognito mode. but nothing seems to work. I've also tried loading the page on different locations but I still get the Site not found pop up.
I have also tried cleaning my project getting my packages again and upgrading them with
flutter clean , flutter pub get and flutter pub upgrade.
Deleted my firebase host file and ran firebase init again.
It's just so wierd that the page can't be found while it can when connected to a vpn or given a random string after the url. I also contacted google with my problem but they also can't seem to find it out because the page loads correctly when the support employee and his team tried it
Can someone help me out?
my firebase.json file
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Your firestore config should be included within the hosting object because firestore is used in conjunction with hosting, not independently. Your configs should be:
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}
}

Flutter Web how to serve file assetlinks.json for Android App Links verification

I am deploying a Flutter Web App on Firebase Hosting.
And a Flutter App on Android.
To use App Links that redirect to my Android application, I need to verify the App Links serving the file assetlinks.json on the web at https://example.com/.well-known/assetlinks.json
How can I make the file available, without 3XX redirects, from my domain, that is Flutter deployed on the web with firebase hosting?
It is enough to add the .well-know folder and the file to the web folder of your Flutter project.
And to change the firebase.json adding headers and rewrites entries.
{
"hosting": {
"public": "build/web",
"appAssociation": "NONE",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"headers": [
{
"source": "/.well-known/assetlinks.json",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
}
],
"rewrites": [
{
"source": "/.well-known/assetlinks.json",
"destination": "/.well-known/assetlinks.json"
},
{
"source": "**",
"destination": "/index.html"
}
]
}
}
build and deploy again and the file is now accessible!
Thanks for the easy guide to
https://blog.bam.tech/developer-news/universal-links-firebase-hosting-and-flutter-web
Firebase Hosting automatically generates assetlinks.json and apple-app-site-association files when they are requested. It doesn't require any extra configuration.
You just need to make sure that your app details (package, SHA256 certificate fingerprints, etc.) are correctly setup in the Project Settings and make sure that in your firebase.json the property appAssociation is set to "AUTO" (or omitted, as AUTO is the default value).
Example firebase.json:
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"appAssociation": "AUTO",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Ref: https://firebase.google.com/docs/hosting/full-config#rewrite-dynamic-links
If I am not mistaken, Firebase stores files in a so called bucket.
The bucket can be directly exposed to the internet or you can use the API to pull the file you need and put it somewhere public on your domain:
https://firebase.google.com/docs/storage/web/list-files
To see how to publish files in a gloud bucket, here is a good answer:
How do you make many files public in Google Cloud Storage?
Be aware the method described provides public access, so make sure you only expose what you want.

Create GitHub service connection using azure rest api giving error

I am trying to create GitHub service connection using azure Devops rest api -
In postman I put following Json Body-
{
"name": "release-1",
"type": "github",
"url": "https://github.com",
"authorization": {
"scheme": "PersonalAccessToken",
"parameters": {
"accessToken": "<Github_Personal_Access_Token>"
}
}
}
This Creates service connection but It gives error when I open service connection in UI and try to verify but if I edit and replace with same Github token In UI then it works. seems like its not taking token I am providing in Json body -
I also see information here on this ongoing issue - https://ljvmiranda921.github.io/notebook/2019/12/28/workaround-azure-github-pat/
I want to automate GitHub service connection creation.
How to create GitHub service connection using Azure Devops rest api ?
How to create GitHub service connection using Azure Devops rest api ?
Are you creating this GitHub service connection?
If so, you should use EndPoints-Create API and your Json Body can follow this format:
{
"authorization": {
"scheme": "Token",
"parameters": {"AccessToken": "YourGitHubPAT"}
},
"data": {},
"description": "",
"name": "YourServiceConnectionName",
"serviceEndpointProjectReferences": [{
"description": "",
"name": "YourServiceConnectionName",
"projectReference": {
"id": "YourProjectID",
"name": "YourProjectName"
}
}],
"type": "github",
"url": "https://github.com",
"isShared": false
}
We should enter the value of YourGitHubPAT, YourServiceConnectionName(twice in two points), YourProjectID and YourProjectName with your own values to make the body work. We can get YourProjectID via Projects-List API.
After running that in PostMan, I can verify it successfully without issues. I guess your issue may have something to do with your parameters. Use
"authorization": {
"scheme": "Token",
"parameters": {"AccessToken": "<Github_Personal_Access_Token>"}
},
Instead of
"authorization": {
"scheme": "PersonalAccessToken",
"parameters": {"accessToken": "<Github_Personal_Access_Token>"}
Update about how to enable grant access to all pipelines:
Dislike other elements like Token, Name and Description, Grant Access Permissions to all pipelines option is managed by another API.
API to enable this option:
https://dev.azure.com/{YourOrganizationName}/{YourProjectName}/_apis/pipelines/pipelinePermissions/endpoint/{YourEndPointID}?api-version=5.1-preview.1
Body:
{
"resource": {
"id": "YourEndPointID",
"type": "endpoint",
"name": ""
},
"pipelines": [],
"allPipelines": {
"authorized": true,
"authorizedBy": null,
"authorizedOn": null
}
}
Note: We need to enter EnterPointID in URL and Body. (Twice!)
In PostMan, you should use PATCH method and application/json type. The YourEndPointID is ServiceConnectionID, you can get this value from EndPoints-Create API's response.
So normally to create a service connection with "Grant Access to All..." enabled, we should run Endpoints-Create first and then run the second API to enable this option.
(And this is the same behavior in Web Portal. When we click Verify and Save button in web browser, it actually also calls these two APIs to complete the process.)

how to create a valid webhook which can be triggered by Provider_verification_published event in pact broker?

to automate contract testing by leveraging pact broker webhooks, I created customized contract_content_changed event with a jenkins job. but when I was trying to add webhook for customer pipeline which is triggered by verification result publishing, it failed several times.
{"consumer": {
"name": "Consumer Service"
},
"provider": {
"name": "Provider Service"
},
"events": [
{
"name": "provider_verification_published"
}
],
"request": {
"method": "POST",
"url": "http://jenkinsserver/jobforconsumerdeployment",
"headers": {
"Accept": "application/json"
},
"body": {"VerificationResultURL","${pactbroker.verificationResultUrl}"
}
}
after removing body element, it created successfully.
by passing body to customer job, it could parse fail/pass and decide whether deployment should go or not go.
if body is not allowed, how consumer pipeline to get the result and continue next step (or stop deployment)?
I am referring to Pact Broker Webhooks.
Configure Jenkins job to "Trigger builds remotely" from Build Triggers section
Generate Jenkins-Crumb by the following link
Steps to create Jenkins-Crumb
Following post request in Pact-Broker is working fine for me on my
local jenkins setup (need to check jenkin permissions to enable
web-hook execution)
{
"events": [{
"name": "provider_verification_published"
}],
"request": {
"method": "GET",
"url": "http://username:password#jenkins_url/job/jenkin_consumer/build?token=abc",
"user" : "username:password",
"headers": {
"Jenkins-Crumb": "c787ce16220300f5ef8287a4474d9acxd"
}
}
}
if body is not allowed, how consumer pipeline to get the result and
continue next step (or stop deployment)?
Yes, body is not allowed in case of 'provider_verification_published' event. So to confirm the verification results, we need to use "can-i-deploy" cli to deply or stop the deployment can-i-deploy. More information provided on Pact Broker Webhooks

How to increase cache expiration date with firebase tools?

I cannot seem to make the max-age work properly with any file. I want to increase the expiration of the cache, and I've been trying to increase only the image time for testing purposes. Still, chrome and firefox state the max-age for the image as 3600 with this json file
The source for the header isn't matching the input path of images in that folder - it needs to start with a /:
{
"firebase": "sistema-de-oficios",
"public": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [{
"source": "/css/images/*.#(jpg|jpeg|gif|png)",
"headers": [{
"key": "Cache-Control",
"value": "max-age=7200"
}]
}]
}
Also, make sure you're on the latest version of firebase-tools which is currently 1.1.4 at the time of writing.