#StackBounty: #javascript #firebase #express #google-cloud-functions #axios Sec-Fetch-Mode instead of Preflight

Bounty: 50

I created login FE and finished it.
And as per usual my goto for ajax was Axios. My code is as follows.

const baseUrl = http://localhost:5000/project/us-central1/api

 { ..data },
  headers: {
   Authorization: 'Basic auth...'
).then(r => console.log(r).catch(e =>console.log(e));

Now when i try to send request to my local firebase cloud function.
I get a 400 bad request.


after checking the request, I was wondering why it wasn’t sending any preflight request, which it should do(to the best of my knowledge) but instead I saw a header named Sec-Fetch-Mode. I searched anywhere it’s a bit abstract. And I can’t seem to figure anything why my request still fails.

Is there anything Im missing in my config of axios?

My FE is running on a VSCode Plugin named live server(

Also, my firebase cloud function has enabled cors

// cloud function expres app
 origin: true

Any insights would be very helpful.

Get this bounty!!!

#StackBounty: #ios #xcode #firebase #firebase-realtime-database #google-cloud-functions How to deploy firebase functions to a new fireb…

Bounty: 200

I have created a new firebase project and connected it to an xcode project which previously was connected to another firebase prj.

I now would like to deploy the same cloud functions that I used in my other firebase project. I attempted adding the new googl.plist and then deploying but found that it just deployed to the old project.

How can I deploy these same functions to my new firebase project?

Get this bounty!!!

#StackBounty: #python-3.x #google-cloud-functions #python-asyncio asyncio seems to be finishing before HTTP request complete

Bounty: 300

I am attempting to run many parallel calls to a web service (formatted by a GET querystring) using asyncio and the calls all immediately return a value of 0. The web service is a physics simulation that returns an integer value with how well it performed. However, I would expect the service to run for approximately 2 minutes and then return the value, however printing out the values from asyncio display immediate 0 values.

This code is part of a genetic algorithm (running DEAP), so what I want to do is to have an outer (generational) loop that runs, with each individual (constructed URL) running in parallel and performing the evaluation. I’m not sure if this has any impact, but it is a Google Cloud Function. The maximum execution time is set well within the bounds of the expected evaluation time, and the maximum memory is also valid.

Here are my asyncio functions, where I’d expect to see some valid integer value if the response returns OK, or -999 if an error was generated:

# AsyncIO functions for interacting with Google Cloud Functions
async def fetchCF(indv: str, session: ClientSession, **kwargs) -> str:
  resp = await session.request(method="GET", url=indv, **kwargs)
  html = await resp.text()
  return html

# Dispatch the CFs and return fitness
async def callCF(indv: str, session: ClientSession, **kwargs) -> int:#float:
    html = await fetchCF(indv=indv, session=session, **kwargs)
  except (
  ) as e:
    return -9999,
    return int(html),

# Called via GA
async def evalAsync(pop: set, **kwargs) -> None:
  async with ClientSession(read_timeout=None) as session:
    tasks = []
    for p in pop:
      indv_url = '%s?seed=%d&x0=%d&y0=%d&x1=%d&y1=%d&x2=%d&y2=%d&x3=%d&y3=%d&emitX=%d&emitY=%d' % 
return await asyncio.gather(*tasks)

And here is how I call them within the generational loop:

for g in generations:
  fitnesses = asyncio.run(evalAsync(population))

For reference, the code works fine with a local physics simulation where I replace the call to asyncio.run with a pool.map call to my local physics driver.

Get this bounty!!!

#StackBounty: #angular #firebase #google-cloud-functions #angular-universal #angular-google-maps Angular Universal not work with Angula…

Bounty: 500

Tech: Angular Cli, Angular version 7, Angular Google Maps, Firebase Functions.

Issue: I’m trying to serve my angular universal app but getting an error for angular google maps when building.

Error I get:

(function (exports, require, module, __filename, __dirname) { import {
Observable } from 'rxjs';

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)

Seems that Angular Universal doesnt like third party libraries.

The resource I followed: https://hackernoon.com/deploying-angular-universal-v6-with-firebase-c86381ddd445

My App Module:

import { AgmCoreModule } from '@agm/core';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFireDatabase } from '@angular/fire/database';
import { AngularFireModule } from '@angular/fire';
import { ServiceWorkerModule } from '@angular/service-worker';
import { AngularFireStorageModule } from '@angular/fire/storage';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { GooglePlaceModule } from 'ngx-google-places-autocomplete';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { NgxErrorsModule } from '@hackages/ngxerrors';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { TruncateModule } from 'ng2-truncate';
import { MetaModule } from '@ngx-meta/core';
import { PreventDoubleSubmitModule } from 'ngx-prevent-double-submission';

// Core App
import { AppComponent } from './app.component';
import { CoreInterceptor } from './interceptor';
import { environment } from '../environments/environment';

// Modules
import { SharedModule } from './shared/shared.module';
import { CoreModule } from './services/core.module';
import { LayoutModule } from './layouts/layout.module';

// Sections
import { COMPONENTS } from './components/index';
import { ROUTES } from './app.routes';

// Guards
import { AuthGuard } from './guards/auth.guard';
import { CreditGuard } from './guards/credit.guard';

  declarations: [
  imports: [

    // This is the Angular google maps module causing issue on build
      apiKey: environment.googleApiKey,
      libraries: ['places']

    BrowserModule.withServerTransition({ appId: 'test123' }),
    ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
  providers: [
    { provide: HTTP_INTERCEPTORS, useClass: CoreInterceptor, multi: true },
  exports: [ RouterModule ],
  bootstrap: [ AppComponent ]
export class AppModule { }

Command I run: serve: npm run build && firebase serve –only functions

Get this bounty!!!