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

Fetch is not defined, when running migrator #11

Open
notflip opened this issue Jun 18, 2023 · 4 comments
Open

Fetch is not defined, when running migrator #11

notflip opened this issue Jun 18, 2023 · 4 comments

Comments

@notflip
Copy link

notflip commented Jun 18, 2023

When running npx directus-migrator -s development -t staging I get the following error, this is the first time I'm using this library, followed the docs.

This is my config

const config = {
    "environments": [
        {
            "name": "development",
            "endpoint": "http://localhost:3000",
            "accessToken": "XXXXXXX"
        },
        {
            "name": "staging",
            "endpoint": "https://XXXXXXXX.cleaver.rocks",
            "accessToken": "XXXXXXX"
        }
    ]
}
 module.exports = config%  

This is the error

2023-06-18 [git:[email protected]] info: Migrating Schema Started
/Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/utils/CRUD.js:48
        const response = yield fetch(url, {
                         ^

ReferenceError: fetch is not defined
    at /Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/utils/CRUD.js:48:26
    at Generator.next (<anonymous>)
    at /Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/utils/CRUD.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/utils/CRUD.js:4:12)
    at CRUD (/Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/utils/CRUD.js:45:12)
    at /Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/migrators/schema-migration.js:69:51
    at Generator.next (<anonymous>)
    at /Users/miguelstevens/.npm/_npx/2f9ed6e235e43e28/node_modules/directus-migrator/dist/migrators/schema-migration.js:31:71
    at new Promise (<anonymous>)
@notflip notflip changed the title Fetch is not defined Fetch is not defined, when running migrator Jun 18, 2023
@CodingButter
Copy link
Contributor

I can't seem to reproduce this error

@Dominic-Preap
Copy link

I have the same issue, It seem it's required node v18 that come with global fetch.

@bhagyesh-7span
Copy link

@CodingButter I have the same issue while I am testing locally with my different instances of the directus with different databases
image
Even though I am using node v18.16
Let me know if any other information is needed to resolve this issue.

@bhagyesh-7span
Copy link

FYI:-
I am able to run it successfully by providing the IP address of my system and it worked like a charm.
image

@CodingButter Thanks for the great tool

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

4 participants