GET https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/res/locales/es-419/allstrings.json net::ERR_ABORTED 404 (Not Found) - http-status-code-404

I'm using Autodesk Forge APIs for developing a web application and everything is working fine, but a new message has appeared in the browser console while developing.
GET https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/res/locales/es-419/allstrings.json net::ERR_ABORTED 404 (Not Found)
browser console message
browser console message
browser console message
This is how I include Forge in my project:
src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"
I've looked up the Changelog of Autodesk Forge and I've found a new change with the latest version.
7.68
Release Date: 5/19/2022
Changed
Update default endpoint from https://developer[-env].api.autodesk.com to https://cdn[-env].derivative.autodesk.com
I don't know if the error is produced because of this change or what is producing it.
Could someone help me?
Thank you very much.
EDIT:
var options = {
env: 'AutodeskProduction2',
api: 'streamingV2',
getAccessToken: getForgeToken,
};
Autodesk.Viewing.Initializer(options, function() {
var htmlViewer = document.getElementById(ventana.items.keys[0]);
var viewerConfig;
viewerConfig = {
extensions: [
'Autodesk.DefaultTools.NavTools',
'Autodesk.Viewing.ZoomWindow',
'ExtensionToolbarHerramientas',
'ExtensionImprimir',
'ExtensionCommand'
]
};
var childNodes = document.getElementById(ventana.items.keys[0]);
childNodes.innerHTML = "";
viewerApp = new Autodesk.Viewing.GuiViewer3D(htmlViewer, viewerConfig);
var strtedCode = viewerApp.start();
if (strtedCode > 0) {
console.error('Failed to create a Viewer: WebGL not supported');
return;
}
console.log('Initialization complete, loading a model next...');
var documentId = 'urn:' + visorForge.urn;
Autodesk.Viewing.Document.load(documentId, onForgeDocumentLoadSuccess, onForgeDocumentLoadFailure);
});

I'm not sure if you already resolved this but I ran into this problem recently. After including language: 'en' (or 'es' in your case) in the InitOptions this error went away.
var options = {
env: 'AutodeskProduction2',
api: 'streamingV2',
getAccessToken: getForgeToken,
language: 'en'
};

Related

How to fix “Cannot GET” Error on Firebase Cloud Functions

I have successfully configured my firebase. Inside my firebase functions folder I have the index.js which I have edited. Below is the code:
const functions = require('firebase-functions');
const app = require('express')();
const {
getAllTodos
} = require('./APIs/todos')
app.get('/todos', getAllTodos);
exports.api = functions.https.onRequest(app);
I have also created a todos.js file under APIs directory in the functions folder. I have written the getAllTodos function.
exports.getAllTodos = (request, response) => {
todos = [
{
'id': '1',
'title': 'greeting',
'body': 'Hello world from sharvin shah'
},
{
'id': '2',
'title': 'greeting2',
'body': 'Hello2 world2 from sharvin shah'
}
]
return response.json(todos);
}
I have successfully deployed it on my firebase. Using the ULR generated to view
https://us-central1-todoapp-f665a.cloudfunctions.net/api
I keep getting a
Cannot GET /
What could be wrong with my code? I have checked other questions that have to do with Cannot GET / error to no avail.
Thanks in advance for the help.
/api is the basic route of your express app. You should add /todos to get the expected response.
https://us-central1-todoapp-f665a.cloudfunctions.net/api/todos

Set retry with dropzone-react-component when upload fails

In my project I'm using React-Dropzone-Component (https://github.com/felixrieseberg/React-Dropzone-Component) based on Dropzone.js.
I'm using this component because I'm developing a SharePoint webpart and there is already an example based on this solution on Microsoft PnP GitHub repository.
Anyway, the upload is working fine, but sometimes, mainly when I keep a web page opened for a couple of minutes doing nothing, I receive an error trying to upload new files. I retry an upload and it fails returning Server responded with (0) code error. I also see on Google Chrome console an ERR_CONNECTION_RESET error. If I try to upload 5 files in second instance, I get error on first 2-3 and then the remaining files works fine. Weird.
I've already investigated my network, but there are no failures. I've also tried with 3 different networks and I've received the same error.
I've also updated the component with the latest Dropzone.js (5.7.2).
This is my code:
let componentConfig = {
iconFiletypes: this.props.fileTypes.split(','),
showFiletypeIcon: true,
postUrl: _context.pageContext.web.absoluteUrl,
autoProcessQueue: true
};
var djsConfig = {
headers: {
"X-RequestDigest": digest1
},
addRemoveLinks:false
};
let myDropzone;
let eventHandlers = {
// This one receives the dropzone object as the first parameter
// and can be used to additional work with the dropzone.js
// object
init: function(dz){
myDropzone=dz;
},
sending: async function (file, xhr) {
var fileName = file.name;
fileName = fileName.replace(/[&\/\\#,+()$~%='":*?<>{}]/g, "");
if (file.size <= 10485760) {
// small upload
await web.getFolderByServerRelativeUrl("/test/"+_listName).files.add(fileName, file, true).then(_ => console.log("Ok!"));
} else {
// large upload
await web.getFolderByServerRelativeUrl("/test/"+_listName).files.addChunked(fileName, file, data => {}, true).then(_ => console.log("Ok!"));
}
},
error:function(file,error,xhr){
file.status = myDropzone.ADDED;
myDropzone.removeFile(file);
myDropzone.enqueueFile(file);
}
};
<DropzoneComponent eventHandlers={eventHandlers} djsConfig={djsConfig} config={componentConfig}>
<div className="dz-message icon ion-upload">Drop files here to upload</div>
</DropzoneComponent>
If I can't prevent this ERR_CONNECTION_RESET error, I would like to set up an automatic retry for these files. The code I've posted above is not working fine or it returns "Uncaught Error: This file can't be queued because it has already been processed or was rejected.".
Is there a solution or a good way to set up a retry?

Cannot get Cypress test to work in React with Okta

I am trying to test my React (v16.10.2) application with Cypress (v4.5.0). Our application is using Okta for authentication (with the client #okta/okta-react 1.3.1).
I can use my app from the browser without any issues. The first time I login, I get the Okta login screen. I enter my user ID and password, and the react client calls the authn endpoint with my creds, and then calls the authorization endpoint to get the token. I am then taken to the first screen of our application.
When I try to login in my Cypress test, my user ID and password are entered into the login screen, the authn endpoint is called successfully, but the authorization endpoint returns a 403 error. Unfortunately, there is no other info about why I am getting the 403.
I have compared the authorization requests between the one that works in the browser, and the one that doesn't work from Cypress. The only real difference I see is that the working browser request has an origin header, whereas the failing one does not.
Question #1: Could the missing origin header be the cause of my problem?
In order to avoid a bunch of CORS and cross-site issues, I had to install a couple Chrome extensions (ignore-x-frame-headers and Access-Control-Allow-Origin-master). I am implementing them in the following code in cypress/plugins/index.js:
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
// The following code comes from https://medium.com/#you54f/configuring-cypress-to-work-with-iframes-cross-origin-sites-afff5efcf61f
// We were getting cross-origin errors when trying to run the tests.
if (browser.name === 'chrome') {
const ignoreXFrameHeadersExtension = path.join(__dirname, '../extensions/ignore-x-frame-headers');
launchOptions.args.push(`--load-extension=${ignoreXFrameHeadersExtension}`);
const accessControlAllowOriginMasterExtension = path.join(__dirname, '../extensions/Access-Control-Allow-Origin-master');
launchOptions.args.push(`--load-extension=${accessControlAllowOriginMasterExtension}`);
launchOptions.args.push("--disable-features=CrossSiteDocumentBlockingIfIsolating,CrossSiteDocumentBlockingAlways,IsolateOrigins,site-per-process");
launchOptions.args.push('--disable-site-isolation-trials');
launchOptions.args.push('--reduce-security-for-testing');
launchOptions.args.push('--out-of-blink-cors');
}
if (browser.name === 'electron') {
launchOptions.preferences.webPreferences.webSecurity = false;
}
return launchOptions;
});
I also added the following to cypress.json:
{
"chromeWebSecurity": false
}
Here is my cypress test:
describe('Order Lookup Test', () => {
const UI_URL: string = 'http://localhost:3000/';
const ORDER_NUMBER: string = '10307906234';
beforeEach(() => {
Cypress.config('requestTimeout', 50000);
cy.visit(UI_URL);
cy.get('#okta-signin-username', {timeout: 10000}).type('xxxxxxxx');
cy.get('#okta-signin-password', {timeout: 10000}).type('xxxxxxxx');
cy.get('#okta-signin-submit', {timeout: 10000}).click();
})
it('should return an order', () => {
cy.get('.number-input', {timeout: 10000}).type(ORDER_NUMBER);
cy.get('.order-lookup-buttons-search-valid').should('be.visible').click();
})
})
Does anyone have any idea what might be going on? What other information should I be including in order to help narrow this down?

SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd. index.html

I am using Visual studio 2015 and ionic and i have been able to build for windows phone 8.1. I created a login page that is to query a php on a different server but i get a problem like this SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd.
index.html
error. My code trying to make a request is
var login = function(name, pw) {
return $q(function(resolve, reject) {
$http.post('http://192.167.180.1//logn/sear.php',{ 'pin': pw }).then(
function(result) {
// No result here..
var re=result.data.split(",");
console.log(re[3]);
if ((re[0] == 0 )) {
// Make a request and receive your auth token from your server
storeUserCredentials(re[2]);
useCredentials(re[1]+" "+re[3]+" "+re[4]);
console.log(LOCAL_TOKEN_KEY);
resolve('Login success.');
} else if(result.data == 1) {
reject('Login Failed.');
}
}, function(err) {
// $scope.response = err.records;
console.log("error");
});
});
};
When you are facing this error while building a Win 8 Phone App, you might want to add private network capability to app manifest.
Credits for the guy who helped me out: https://sonyarouje.com/tag/network-error/
- there you'll find step-by-step instruction how to do it.
There is also another answer how to do it on SO:
WinJS.xhr: Network Error 0x2efd, Could not complete the operation due to error 00002efd

cordovaGeolocation error: position retrieval timed out

Hello I want to implement some geolocation features in my app.
So I implemented a watchposition function like this:
.controller('NavigationCtrl', function ($scope,$cordovaGeolocation) {
var watchOptions = {
frequency : 1000,
timeout : 20*1000,
enableHighAccuracy: false // may cause errors if true
};
var watch = $cordovaGeolocation.watchPosition(watchOptions);
watch.then(
null,
function(err) {
alert("WatchPosition failed: "+JSON.stringify(err));
},
function(position) {
$scope.position = position;
}
);
})
Well in the first call of the template I get a geolocation but than after 20 seconds I get an error:
code:3, message:'Position retrieval timed out'
I'm testing the app on a iPhone 5s iOS 8.3.
I googled around and found out that cordova 3.1 has some errors with geolocations so I choose to use the html api for geolocations like here:
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation
but it didn't show me anything in my ionic-framework app.
What am I missing?
I'm using cordova 4.3.0 and ionic 1.3.19.
I found out that I have to put the code in a $ionicPlatform.ready function to be sure that the device is ready before it start geolocating. Now it working fine.

Resources