Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has been blocked by CORS #408

Closed
heluansantos opened this issue Jun 5, 2023 · 3 comments
Closed

has been blocked by CORS #408

heluansantos opened this issue Jun 5, 2023 · 3 comments

Comments

@heluansantos
Copy link

Screenshot 2023-06-05 at 12 03 06
@israel-dv
Copy link

I have the same problem. Someone has any idea how to solve this ?

@heluansantos
Copy link
Author

heluansantos commented Jun 10, 2023

I have the same problem. Someone has any idea how to solve this ?

I fix this problem with a server in NodeJs, for example:

const cors = require("cors");
const { Client } = require("@notionhq/client");

require("dotenv").config();
const app = express();
app.use(cors());

const notion = new Client({
  auth: YOUR_NOTION_KEY,
});

app.get("/database", async (req, res) => {
  try {
    const response = await notion.databases.query({
      database_id: YOUR_DATABASE_ID,
    });

    res.json(response);
  } catch (error) {
    console.error("Error querying Notion database:", error);
    res.status(500).send("Internal Server Error");
  }
});

app.listen(3000, () => {
  console.log("Server is running on port 3000");
});

And with a get in front-end like:

axios.get("http://localhost:3000/database");

@ronovan
Copy link
Contributor

ronovan commented Jun 12, 2023

Hello! Looks like this issue has been resolved. I am going to close this issue, but please re-open if you encounter the problem again.

@ronovan ronovan closed this as completed Jun 12, 2023
@ronovan ronovan closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants