Categories
Mastering Development

React Hook Dependencies – Generic Fetch Hook

I’ve followed many tutorials for how to set up my own custom generic useFetch hook. What I came up with works well, but it is breaking some Rules of Hooks. Mostly, it doesn’t use the "correct" set of dependencies. The generic hook accepts a url, options, and dependencies. Setting the dependencies up as all three […]

Categories
Mastering Development

Cannot get cookies from heroku server(NodeJS) in react app because the ‘sameSite’ attribute is not allowing

I’m trying to fetch in reactjs app to get the response from my nodejs API stored on heroku, but I’m getting the error(bad request) even with everything configured. On my reactjs ‘package.json‘: "proxy": "http://myserver.herokuapp.com" Reactjs fetch: fetch(‘http://myserver.herokuapp.com/auth/google/check’, { method: ‘GET’, headers: {‘Content-Type’ : ‘application/json’}, credentials: ‘include’ }) .then(response => response.json()) .then(data => { if(data === […]

Categories
User Help Web Pro

SEO – onload components seen as separate pages by Google

I have tried to optimized my blog by loading some component after the page load to improve the performance. Since I have done this, the performance has increased but I now see that those components have been indexed in Google search. I have use the following code to load my components window.onload = function (e) […]

Categories
Mastering Development

Putting Async functions into useEffect() hook in React

I’m finishing up an app in which I want to hide my GoogleMap API key behind my secure API. My intention is to call for the API key once I verify that I have an authenticated user. The problem is that between the async calls, changes are not reflected with the state change. This is […]

Categories
Mastering Development

React: Re-rendering a page when passing an id parameter in the url

I’m new to React js, and i have a doubt: in my index page i declare the routes, calling for the component <Route path="/assignments/organization/:id" component={Manifest} /> In the "manifest" component, i have 2 components: a "sidebar" with the links a "feed" component that calls an api retrieving my information to build the list of assignments […]

Categories
Mastering Development Software

How do I use Rest Data Source API with access tokens?

I’m trying to get data back from an API without having to loop through an RDD, and I found the Rest Data Source Library on Git hub: https://github.com/sourav-mazumder/Data-Science-Extensions/tree/master/spark-datasource-rest The issue I’m running into is how to incorporate Access Tokens in with parameter mapping. When it comes to the supported options the descriptions has this for […]

Categories
Mastering Development System & Network

Access denied (SA doesn’t have storage.objects.create access) when trying to upload using a preSigned url to google cloud storage

Having issues trying to allow a client to upload a file via a presigned url. Error received <?xml version=’1.0′ encoding=’UTF-8′?> <Error> <Code>AccessDenied</Code> <Message>Access denied.</Message> <Details> urlsigner@<project>.iam.gserviceaccount.com does not have storage.objects.create access to <bucket-name>/<filename>.pdf. </Details> </Error> Code executes as a gcp cloud function and is used for generating. Cloud function is default service account function was […]

Categories
Mastering Development System & Network

Access denied (SA doesn’t have storage.objects.create access) when trying to upload using a preSigned url to google cloud storage

Having issues trying to allow a client to upload a file via a presigned url. Error received <?xml version=’1.0′ encoding=’UTF-8′?> <Error> <Code>AccessDenied</Code> <Message>Access denied.</Message> <Details> urlsigner@<project>.iam.gserviceaccount.com does not have storage.objects.create access to <bucket-name>/<filename>.pdf. </Details> </Error> Code executes as a gcp cloud function and is used for generating. Cloud function is default service account function was […]

Categories
Mastering Development System & Network

Access denied (SA doesn’t have storage.objects.create access) when trying to upload using a preSigned url to google cloud storage

Having issues trying to allow a client to upload a file via a presigned url. Error received <?xml version=’1.0′ encoding=’UTF-8′?> <Error> <Code>AccessDenied</Code> <Message>Access denied.</Message> <Details> urlsigner@<project>.iam.gserviceaccount.com does not have storage.objects.create access to <bucket-name>/<filename>.pdf. </Details> </Error> Code executes as a gcp cloud function and is used for generating. Cloud function is default service account function was […]

Categories
Mastering Development

REACT and Axios: GET request blocked by CORS policy: Response to preflight request doesn’t pass access control check [duplicate]

I’m trying to do a GET request through axios and react. However, I am getting a CORS error. My code: axios(instantaneousWindUrl, { method: ‘GET’, mode: ‘no-cors’, headers: { ‘Access-Control-Allow-Origin’: ‘*’, ‘Content-Type’: ‘application/json’, }, withCredentials: true, credentials: ‘same-origin’, }).then(res => { const windInfo = res.data console.log(windInfo) }); Error: Access to XMLHttpRequest at ‘http://mobvaer.kystverket.no/v2/api/stations/5265049’ from origin ‘http://localhost:3001’ […]