public-transport/hafas-client

support environments without support for createRequire() & JSON modules

Open

#300 opened on Oct 22, 2023

View on GitHub
 (5 comments) (0 reactions) (0 assignees)JavaScript (60 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (353 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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