public-transport/hafas-client

support environments without support for createRequire() & JSON modules

Open

#300 geöffnet am 22. Okt. 2023

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (60 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (353 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Hi there, I just tried to deploy a Next.js app with React server components using hafas-client to Vercel. It always worked as intended on my machine, but never when deployed to a lambda function as I always got a "could not import base.json" error. I even went as far as forking the package and replacing the require statement with an import, but that resulted in a lambda timeout. The solution was to use node 16 instead of node 18 in the Vercel config. I also changed the region from Washington D.C. to Frankfurt, but that probably won't make any difference.

I hope this info helped anyone, but it took me like 3 hours to troubleshoot.

Edit: i reverted back to using the official published npm package instead of my fork, but this broke it again and i got the " Cannot find module './base.json'" Error again.

Contributor Guide