Closed joeybellerose closed 4 years ago
@joeybellerose can you provide any more details about what the error is?
Also, I see you have a now.json
. Are you running the vercel
command? I wonder if maybe it'd need to be updated to vercel.json
?
@benmccann The error i get is 500 "Unexpected token O in JSON at position 0"
I have been running the vercel
command and tried changing to vercel.json
to no avail.
Also...it looks like vercel recognizes a function named index
but i have no idea where that is coming from.
That index
is the function that runs serverless https://github.com/thgh/now-sapper/blob/master/index.js#L73)
The screenshots look ok, what happens when you visit /company/ticker.json
? It looks like that response might contain an error that will help you further.
@thgh Thanks for the clarification. I get the following response when I visit /company/ticker.json
:
Only absolute URLs are supported
Also in [ticker].svlete
my fetch looks like this const res = await this.fetch(
company/${ticker}.json);
Does this help?
You probably want this instead: (note the URL starting with /
)
this.fetch(`/company/${ticker}.json`);
@thgh Thanks so much! That did the trick.....I also overlooked that you need to have environment variables for Production as well as Preview. Thanks again for all the help!
I'm able to get server routes to work locally but get a 500 error when I deploy to Vercel. My folder structure looks like this:
Here's my now.json file:
Here's my server.js file: