Next.js Discord

Discord Forum

serverless function has crashed

Unanswered
Alι_ Aryαɴ posted this in #help-forum
Open in Discord
I was using g-i-s but unfortunately it's not working anymore so I replaced it with async-g-i-s

but, when I write

const gis = require('async-g-i-s')


My API got crushed for no reason there's no errors in logs

12 Replies

It'll take so long
and no one will reply
:blobsweats:
may i see the API code?
const { unicodeToString, handleCatch } = require('../lib/Utils')
const router = require('express').Router()
const gis = require('async-g-i-s')

router.get(
    '/gisearch',
    handleCatch(async (req, res) => {
        const { query } = req.query
        if (!query) return res.json({ parameters: 'gisearch?query=' })
        const urls = await gis(query)
        const result = urls.map((e) => unicodeToString(e.url))
        res.status(200).json(result)
    })
)
do you use Next.js?
@tafutada777 do you use Next.js?
🤔 it's express API
maybe vercel.json can elaborate:
{
  "version": 2,
  "builds": [
    {
      "src": "index.js",
      "use": "@now/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "index.js"
    }
  ]
}
Nodejs
I guess, it can't be fix nevermind,
thanks for your help :meow_coffee:
I decided to recreate that module inside my project so it'll work
sure. you might want to get it work in Edge Runtime, which is measured in CPU time(50ms) rather than wall time(10s). the lib seems to be I/O bound, so seems to be suitable for Edge.