The Map component is having intermittent issues with error messages, such as "Uncaught (in promise) - H.map.DataModel#add (Argument #0 [object Object])"

In my VueJs application, I am utilizing Here Maps (Freemium plan) along with vue-router.

I have created a Vue component to display a map using Routing to generate an SVG path between 2 points by referring to the following resources:

I have included Here Maps library version 3.1 through CDN:

https://js.api.here.com/v3/3.1/mapsjs-service.js
https://js.api.here.com/v3/3.1/mapsjs-data.js
https://js.api.here.com/v3/3.1/mapsjs-ui.js
https://js.api.here.com/v3/3.1/mapsjs-mapevents.js

However, the Vue component sometimes throws an error:

Uncaught (in promise) D {message: "H.map.DataModel#add (Argument #0 [object Object])"
The observations so far are:

  • Reloading the page sometimes resolves the issue while other times it does not
  • Certain route paths consistently work without any errors

Despite my efforts to troubleshoot, I have been unable to pinpoint the root cause. I suspect it might be related to the interaction between vue-router and loading Here Maps library via CDN.

Is there an npm package available for Here Maps? Have you faced a similar issue before?

Below is the code for my map Vue component:

<template>
  <div>
    <div ref="map" class="here-map__map" />
  </div>
</template>>
<script>
export default {
  // Vue component logic
}
</script>
<style lang="scss">
.here-map {
  &__map {
    height: 400px;
    margin: 0 auto;
  }
}
</style>

Thank you for your assistance.

Answer №1

Indeed, we offer a guide on incorporating the HERE JS API into VueJs on our blog. However, we do not provide technical support for integrating third-party libraries or frameworks with the HERE JS API.

Nevertheless, here are some suggestions:

  1. Make sure to include all HERE JS libraries (mapsjs-core.js, mapsjs-service.js, etc.) within the <head> HTML element, as demonstrated in our examples at
  2. Refer to the instructions for initializing the map in our blog post at . It mentions the importance of using the mounted method instead of the created method when working with the map as a DOM component.
  3. Remember that the HERE map container element should not be part of Vue's Virtual DOM.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it necessary to reload the page each time to see updates on the navbar in nextjs?

I recently developed a Next.js application with a Navbar component integrated into my layout.tsx file. The challenge arises when a user logs in and is redirected to the home page, which showcases a link in the Navbar for viewing their profile. However, I n ...

Showing a collection of articles on a webpage using Nuxt/content - Step by step guide

I have implemented the nuxt/content module to establish a documentation website. In a recent post on the Nuxt blog, they demonstrated displaying content in a separate index.vue page and post details on the _slug.vue page. My goal is to present a list of ...

Create a sinusoidal wave and stream it through the web browser

I'm looking for a code snippet that can: create a sine wave (an array of samples) play the wave This should all be accomplished in a web browser using an HTML5 API in JavaScript. (I've tagged this with web-audio, but I'm not entirely ...

How to get the initial item from an API using JavaScript mapping

When mapping my arrays, I usually use the following code: moviesList.map(movie => <MovieCard movieID={movie} key={movie} However, there are instances where my API returns multiple results. Is there a way to modify my .map function to display only t ...

The presence of a Bootstrap addon is resulting in horizontal scrolling on mobile devices within the webpage

I am encountering a peculiar issue with an input-group in my cshtml file which features a Bootstrap addon. The problem arises on mobile devices, where upon focusing on the input field, the page scrolls horizontally to the right, revealing the right margin ...

Unlocking the power of popups with Angular

As a beginner in AngularJS, I have encountered an issue where a popup appears when clicking on the "login/signup" button. Now, I want the same popup to appear when clicking on the "upload resume" button as well. Below is the code that is currently working ...

Using only if-else statements and else-if conditions in JavaScript, arrange four numbers in order

How can I arrange 4 numbers in ascending order using only if-else and else-if statements in JavaScript without utilizing the sort function? ...

Why can't we use percentages to change the max-height property in JavaScript?

I am currently working on creating a responsive menu featuring a hamburger icon. My goal is to have the menu list slide in and out without using jQuery, but instead relying purely on JavaScript. HTML : <div id="animation"> </div> <button ...

Is there a way to transfer the submitted data to a different page without being redirected to it using #php and #ajaxjquery?

Hey there, I could use a little assistance. How can I send data to page update.page.php when submitting a form on index.php without being redirected? I want the functionality of sending a message from one page to another without having to refresh the ent ...

Mapping an array within an array and then pushing the result

I am facing a challenge with an empty array that I have: items: [ { item:null, category_id: null, } ] Can anyone help me figure out how to populate this empty array with the data? Here is an example of the data I have: ...

Is there a way to bring my popup closer to my button?

Check out my jsfiddle example here: https://jsfiddle.net/annahisenberg/ft10ersb/34/ Currently, I have the following code: <div id="more_options_popup" style={{ left: this.ref.current.offsetLeft - 140 + "px", top: this.ref.current.offsetTo ...

Tips for transferring JSON data to a CodeIgniter view

I have a query regarding how to replace a specific section of my webpage with data returned from the controller. Currently, I have a page that displays movie details directly fetched from the database. My goal is to only display movies of a particular genr ...

The issue arises when the cache code in jQuery Ajax interferes with the callback function, causing it to

I encountered an issue with my code related to cache. The problem arises when there is an ajax call with a callback in the success function. var localCache = { /** * timeout for cache in millis * @type {number} */ timeout: 30000, ...

Send data with AJAX and PHP without refreshing the page

I have implemented the "add to favorite" feature on my WordPress project using a <form> submission. Each time I click on the add to fav button, it works fine, but the page always reloads which is quite annoying. To tackle this issue, I decided to imp ...

Is there a way to execute code after completion of all threads?

I've developed a multi-threaded web crawler that downloads a website and stores it in a database, however, this process takes around 4 minutes. In an attempt to speed up the crawling process, I implemented the node.js cluster module. Yet, I'm fac ...

Completing the regex properly

When using my editor, I am able to paste a video URL which is then converted by regex into an embed code. The URL in the WYSIWYG-editor looks like this: Once converted, the output HTML appears as: <p>http://emedia.is.ed.ac.uk:8080/JW/wsconfig.xml& ...

Tips for editing bootstrap-vue table columns using non-Latin characters?

I need to create a table using the Cyrillic alphabet, but the keys of the object must be in the Latin alphabet within the program. Example : export default { data() { return { wmsFields: ['№', 'Наименование', ...

Implementing Google AdWords Conversion Tracking code on a button click event using knockoutjs

I recently received the following code snippet from Google AdWords for tracking purposes. <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 973348620; var google_conversion_language = "en"; var ...

Generating a JSON file using JavaScript

Currently, I am attempting to create a JSON file through JavaScript. Since I haven't found the appropriate code yet, I am experimenting with creating a text file instead. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html&g ...

What steps should I take to ensure a Vue 2/Vuetify form does not submit if the mandatory fields are left blank?

I developed a contact form using Vue 2/Vuetify 2 for a project I am working on. The form successfully submits to Strapi, the CMS that I am utilizing. However, despite having set rules and validation, it still submits with empty fields. The best progress I ...