Skip to content

Notion sdk package compatibility #235

@mathieucollet

Description

@mathieucollet

Is your feature request related to a problem? Please describe.
The error may be mine, but I think the js package Notion-sdk-js is not compatible with deployment via NuxtHub. Here's my little request, I don't realize how much work it would take, but nothing ventured, nothing gained.

Describe the solution you'd like
I mean, juste having the package working would be great 👍🏼

Describe alternatives you've considered
Doing requests to the Notion API without the use of the package.

Additional context
Here is the simplified code for server/api and the component using it. Code that, just for the record, works when running the dev version locally, but doesn't work in production or via wrangler.

// /server/api/database.get.ts
import {Client, collectPaginatedAPI} from "@notionhq/client"

const { notionApiToken, databaseId} = useRuntimeConfig()
const notion = new Client({
    auth: notionApiToken
})
const getData = async () => await collectPaginatedAPI(notion.databases.query, {
    database_id: databaseId,
    page_size: 100
})
export default defineEventHandler(() => getData())
<!--/components/Dashboard.vue-->
<template>
  <div>
    <p v-if="status === 'pending'">Loading....</p>
    <div v-else>{{ data }}</div>
  </div>
</template>

<script setup lang="ts">
const {status, data} = await useLazyFetch("/api/database")
watch(data, (newData) => {})
</script>

Thanks for reading

Metadata

Metadata

Assignees

No one assigned

    Labels

    edge-compatibilitySomething is not yet edge-compatible?questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions