Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
Property does not exist on type String error

I'm trying to send a bug report via API, and have an authentication token in my apps metadata settings, which works usually. I refactored that logic out of my main.js and into it's own class, but now I'm receiving 403 errors, which I can only imagine is due to how I'm referencing the token.

  class Logger {

   constructor(settings) {
   // getting the settings here and assigning it to the constructor variable
     this.settings = settings;
   }
   static async logInfo(data = {}) {
     console.log('Hello!')
     const url = 'https://sampleUrl'
       const response = await fetch(url, {
       method: 'POST',
       headers: {
         "X-TrackerToken": `${metadata.settings.pivotal_token}`,
         "Content-Type": "application/json"
       },
       body: JSON.stringify(data)
     });
     return response.json();
   }
 }

 const metadata = {
   settings: ''
 }
 const logger = new Logger(metadata.settings);

How I call the Logger class in Main.js

Logger.logInfo(metadata.settings, bugInfo).then(console.log('print'))
      })

On mouse hover the tooltip returns the message 'Property does not exist on type String error.', before the move into it's own class I referenced it with the same syntax, so not sure how to proceed here.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You are passing the settings with the constructor, so you need to use this setting in the Logger class, but you are using another variable for X-TrackerToken that is not defined.

const metaData = {
  settings: ""
}

metadata.settings.pivotal_token // ---> undefined

You are trying to get pivotal_token from the settings which is a string and obviously, there is no pivotal_token method existing for your settings strings.

about 4 years ago · Juan Pablo Isaza Report

0

You are doing metadta.settings.pivotal_token but metadta.settings is a string. It's not having any pivotal_token property.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!