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

263
Views
relativeURL.replace is not a function error in Next.js

Why do I get this error in my Next.js app?

TypeError: relativeURL.replace is not a function. (In 'relativeURL.replace(/^/+/, '')', 'relativeURL.replace' is undefined)

Request.js file

const API_KEY = process.env.API_KEY

const requests = {
  fetchTrending: {
    title: 'Trending',
    url: `/trending/all/week?api_key=${API_KEY}&language=en-US`,
  },
}

export default requests

axios.js file

import axios from 'axios'

const instance = axios.create({
  baseURL: 'https://api.themoviedb.org/3/',
})

export default instance

Banner.js file

import React, { useState, useEffect } from 'react'
import { InformationCircleIcon, PlayIcon } from '@heroicons/react/solid'
import axios from '../axios'
import requests from '../Requests'
import Image from 'next/image'

function Banner() {
  const [movie, setMovie] = useState([])
  useEffect(() => {
    async function fetchData() {
      const request = await axios.get(requests.fetchTrending)
      setMovie(
        request.data.results[
          Math.floor(Math.random() * request.data.results.length - 1)
        ]
      )
      return request
    }
    fetchData()
  }, [])

  console.log(movie)

  function truncate(string, n) {
    return string?.length > n ? string.substring(0, n - 1) + '...' : string
  }

  return (
    <header className="relative h-[100vh] w-[100vw] bg-black">
      <div className="relative z-50 ml-10 h-[190px] pt-10">
        <Image
          src={`https://image.tmdb.org/t/p/original/${movie?.backdrop_path}`}
          layout="fill"
          objectFit="contain"
          objectPosition="left"
        />
 </div>
    </header>
about 4 years ago · Juan Pablo Isaza
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!