I'm working on an app using React Native and Expo. I'm not new to react native, but this is the first job that required the use of expo. My problem is I'm sending error messages from the server that would be usefull for front end logic, but expo constantly overrides the error with an error that Expo generates, and I can't figure out how to retreive the message from the server.
Server code:
...Random server logic
return res.status(400).json({ msg: "invalid user credentials" });
What I receive in the expo app.
message(pin):"Request failed with status code 402"
name(pin):"Error"
stack(pin):"Error: Request failed with status code 402 at createError (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:176428:17) at settle (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:176418:14) at EventTarget.handleLoad (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:176316:9) at EventTarget.dispatchEvent (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:32785:27) at EventTarget.setReadyState (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:31854:14) at EventTarget.__didCompleteResponse (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:31696:16) at http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:31806:47 at RCTDeviceEventEmitter.emit (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:7450:37) at MessageQueue.__callFunction (http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:3225:44) at http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:2938:17"
Related
Hey guys im trying to deploy my website and I keep getting stuck on these issues vercel build then vercel deploy -- prebuilt I get the error message of Error: ENOENT: no such file or directory, stat '/vercel/path0/.vercel/output/functions/_next/data/f3doRdmrRJC9QWLs2rG4w/index.json.func'
But when I run vercel deploy depending on my environmental variables for NEXT_PUBLIC_BASE_URL if I put http://portfolio-build-lem0bum28-bchang0999.vercel.app as my value the result i get is Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error FetchError: invalid json response body at https://vercel.com/login?next=%2Fdeployments%2Fportfolio-build-lem0bum28-bchang0999.vercel.app%3Fhost%3Dportfolio-build-lem0bum28-bchang0999.vercel.app%26redirect%3D1%26section%3D reason: Unexpected token < in JSON at position 0
if i put the NEXT_PUBLIC_BASE_URL with a value of http://localhost:3000 the error code I get is FetchError: request to http://localhost:3000/api/getPageInfo failed, reason: connect ECONNREFUSED 127.0.0.1:3000
any help to resolve this so I can deploy and move on from this project would be nice
http://portfolio-build-lem0bum28-bchang0999.vercel.app errorlocalhost:3000 error
hello guys i am new in react js Am getting an error when i creating an react app below i share my error screenshot please checkout and try to fix my error
error screenshot https://ibb.co/rtXs5yv
How to handle the error: Error: getaddrinfo ENOTFOUND unexistantwebsite.com with the node package Websocket(Ws) without making the app crashing ?
I just tryed to create a websocket connect on an non-existant website and that make all the app crashing :
var ws = new WebSocket('wss://unexistantwebsite.com/', {
binaryType: "arraybuffer"
});
I tried many way to handle the error but nothing works.
Surround with try catch: KO
Add .catch on the constructor end: KO (even invalid that's normal I suppose)
I just want to handle the error avoiding the app to crash.
I am creating a progressive web application (pwa) and try to register service worker to test offline feature. The folder structure is like below:
-- views
-- index.pug
-- sw.js
-- public
-- js
-- main.js
-- index.js
index.js file is server file, main.js is the file that being link in each .pug file. I embedded the service worker register code in, the code is like following
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('./sw.js').then(function(registration) {
// Registration was successful
console.log('Service Worker registration successful with scope: ', registration.scope);
// console.log('Service Worker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
The 404 error keeps pop up in localhost also the deployed URL which I have no clue why, how to solve this?
ServiceWorker registration failed: TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.
Thanks
Solutions (UPDATE) -
Include app.use('/', routes) ,or wherever the service-worker file at into index.js file.
you could use the full url path for the registration for example:
navigator.serviceWorker.register('ScriptsFolder/subFolder/sw.js')
The only way I have found to solve the TypeError issue when starting a nodejs service worker is to put the service worker script in the root directory of your application, in my case the root of my Amazon EC2 web server.
Wish the error message was more descriptive, TypeError is not terribly helpful. But this fix worked for me.
I am very new to node.js, I just followed the steps to create a simple node.js application. Here it is on github
I ran the command jitsu deploy from the terminal to deploy it on nodejitsu, however I got this error right here, please any help on what could be wrong with code files?
Here is the code on git hub
Here is the error that is appearing:
prompt: Is this ok?: (yes) yes
info: Creating snapshot 0.0.0-5
info Uploading: [=============================] 100%
info: Updating app test
info: Activating snapshot 0.0.0-5 for test
info: Starting app test
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy the app
error:
error: Error spawning drone
error: Script took too long to listen on a socket
error:
error: This type of error is usually a user error.
error: Error output from Haibu:
error:
error: Error: Error spawning drone
error: at Object.onTimeout [as _onTimeout] (/root/haibu-orchestra/node_mod
ules/haibu/lib/haibu/core/spawner.js:396:15)
error: at Timer.list.ontimeout (timers.js:101:19)
help: For help with this error contact Nodejitsu Support:
help: webchat: <http://webchat.nodejitsu.com/>
help: irc: <irc://chat.freenode.net/#nodejitsu>
help: email: <support#nodejitsu.com>
You're server.js is exporting a function, but that doesn't get run. Just the body of your start function as top-level code directly inside the server.js module so that it executes when nodejitsu starts your application.
Nodejitsu is very picky about how quick your deployments listen on the system. There is a certain time frame between the start of deployment and end of deployment before your deployment is considered a failure. When it doesn't listen on a port for so long, it ends up giving you this error.
Rather than using your current start function, why don't you try creating your HTTP socket in index.js and then passing it into your start function as well, since you're already passing routes and handle to it?
For example, in index.js:
var http = require('http'),
server = http.createServer().listen(8080);
start(server, router.route, handle);
Then, rather than using http.createServer(onRequest).listen(8080) in your server.js file, you can use something like:
var start = function (server, route, handle) {
function onRequest(request, response) {
/* Your request stuff here */
}
server.on('request', onRequest);
};
This would most likely solve the whole problem.