Thunkable call to NodeJS encountering 403 forbidden error

@eddie.rebehy, @jared, @cttricks, @jared, @muneer,

I’m having a little trouble with integrating NodeJS with the WebViewer. It is a bit off topic, but it does involve Thunkable integration. So here is my situation:

My ultimate goal it to import a file into thunkable. I have it working on my local emulation of firebase, but I am having trouble getting it to work on the cloud deployment.

The first step is create a listener using express. No problem, works on both deployed and emulated systems.

exports.thunk = functions.https.onRequest(app);`
app.listen( () => {
     functions.logger.info(`Express App listening `, {structuredData: true});
});

On the get request a display a form. Also works great on deployed and emulated systems.

// Display a form for uploading files.
app.get('/', (req, res, next ) => {
  //On a get request, send back this form to the user
  functions.logger.info(`GET request Made`, {structuredData: true});
  res.render('form.pug');
});

here is the form.pug

doctype html
html(lang="en")
  head
    title Static Files
    meta(charset='utf-8')
    link(rel="stylesheet", href="/static/main.css")
  body
    form(method="POST", action="/upload", enctype="multipart/form-data")
      input(type="file", accept=".gpx", name="file" )
      input(type="submit")

Both emulated and deployed systems allow me to identify a file.

https://us-central1-backroad-discovery-companion.cloudfunctions.net/thunk/

on submit

I’m guessing there is some JavaScript / promise / ??? that is causing my problems. Any help is appreciated

Firebase makes any HTTP function as private not public. From the console change it to public and try.

Happy new year

Thanks. Tried that. No luck. :frowning:

1 Like

FYI, i found a much easier way to import a file into thunkable.

1 Like