English 中文(简体)
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT when trying to use the NuxtJS api
原标题:

I am using NuxtJS 2, I deployed my app on Vercel and everything has been working fine. The things changed when I decided to add serverMiddleware, I created a api folder, I added the following to the nuxt.config.js file:

serverMiddleware: [{
  path:  /api ,
  handler:  ~/api/newsletter.ts 
}],

And everything works just fine locally. As expected. I released it to my preview environment, added the corresponding environment variables, but when I try to do an api call I get the following error: POST http://localhost:3000/api/subscribe net::ERR_BLOCKED_BY_CLIENT in the release environment.

I am aware it says local host. I tried adding a vercel.json with the corresponding configuration, but it won t work in Vercel. How do I get to use api call without it being denied by the client?

问题回答

If you are sure your app is working well on your local, then it might be cors issue. Try this: https://vercel.com/guides/how-to-enable-cors





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签