Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

handle node 6 gracefully #2308

Closed
ravivco opened this issue Apr 30, 2018 · 12 comments
Closed

handle node 6 gracefully #2308

ravivco opened this issue Apr 30, 2018 · 12 comments

Comments

@ravivco
Copy link

ravivco commented Apr 30, 2018

Bug Report

After upgrading to prisma 1.7.3 and applying the new prisma.yml structure >>
removing keys: service, stage, cluster
adding key: endpoint

Using node-v6.11.1

Getting this Error:
TypeError: url_1.URL is not a constructor
Stack trace:

at parseEndpoint (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/src/PrismaDefinition.ts:405:15) at PrismaDefinitionClass.get [as service] (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/src/PrismaDefinition.ts:108:13) at PrismaDefinitionClass.validate (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/src/PrismaDefinition.ts:148:14) at PrismaDefinitionClass.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/src/PrismaDefinition.ts:78:12) at step (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/dist/PrismaDefinition.js:32:23) at Object.next (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/dist/PrismaDefinition.js:13:53) at fulfilled (/usr/local/lib/node_modules/prisma/node_modules/prisma-yml/dist/PrismaDefinition.js:4:58)

When downgrading to V1.6.3
npm i -g prisma@1.6.3
and restoring the prisma.yml old format (with cluster and service definitions and without the endpoint: url), I can deploy again.

Upgraded again to prisma 1.7.3 and maintained the keys:
service, stage, cluster + endpoint key,
I can deploy again (using the new V)

@marktani
Copy link
Contributor

Can you share a minimum setup to reproduce this error?
Ideally in the form of a repository.

@marktani marktani added the bug/0-needs-info More information is needed for reproduction. label Apr 30, 2018
@grbbabu
Copy link

grbbabu commented May 8, 2018

Hi @marktani ,
I have used this setup https://www.prisma.io/docs/tutorials/prisma-basics/getting-started-ouzia3ahqu and when I tried to do prisma playground, I got the below error.

➜ hello-world prisma playground
▸ url_1.URL is not a constructor

Get in touch if you need help: https://www.graph.cool/forum

@grbbabu
Copy link

grbbabu commented May 8, 2018

Hi @marktani ,
I upgraded my node version to 10.0.0 and the issue got fixed. Earlier node version was in 6.9.1

@marktani
Copy link
Contributor

marktani commented May 8, 2018

Thanks for the follow up! The CLI should handle older node versions gracefully.

@marktani marktani changed the title Prisma 1.7 endpoint Bug - cannot deploy "url_1.URL is not a constructor" on node 6 May 8, 2018
@BartlomiejLewandowski
Copy link

I'm running 6.9.4, had the same error. Can we include the requirements for the node version in the getting started docs? I wasn't able to find that anywhere.

@BartlomiejLewandowski
Copy link

Or maybe we could include another step of installing nvm, and creating a version file in the directory.

@marktani marktani added area/cli and removed bug/0-needs-info More information is needed for reproduction. labels May 24, 2018
@marktani marktani changed the title "url_1.URL is not a constructor" on node 6 handle node 6 gracefully Jun 16, 2018
@stale
Copy link

stale bot commented Jan 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale Marked as state by the GitHub stalebot label Jan 9, 2019
@stale stale bot removed the status/stale Marked as state by the GitHub stalebot label Jan 9, 2019
@timsuchanek timsuchanek added this to the 1.x cli, client, bindings milestone Jan 9, 2019
@divyenduz
Copy link
Contributor

I am unable to reproduce this issue with node 6.x. This was resolved in 6.13.0 via nodejs/node#7448

However, CLI should still handle the crash gracefully, so, I would keep this open.

@divyenduz
Copy link
Contributor

I can also confirm that I am able to reproduce this issue in node version 6.11.1.

@divyenduz
Copy link
Contributor

Following vagrant file can be used to reproduce this

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  config.vm.synced_folder "/Users/divyendusingh/Documents/projects/graphcool/prisma", "/home/vagrant/prisma"
  config.vm.synced_folder ".", "/home/vagrant/prisma-3205"
  config.vm.provision :shell, :path => "bootstrap.sh"
end
#!/usr/bin/env bash

# Node
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

nvm install v6.11.1

Then vagrant ssh, go to /home/vagrant/prisma/cli/packages/prisma-cli folder and run ./dist/index.js (to run Prisma CLI).

I was able to reproduce this issue while using deploy command and not version or init.

@divyenduz
Copy link
Contributor

This is fixed in the latest beta - 1.25.0-beta.21 (npm install -g prisma@beta). Please give it a go and let me know if that works for you. Thanks.

@divyenduz
Copy link
Contributor

This is available in the latest version 1.25.0, npm install -g prisma. I am closing this issue. Please let me know if the issue still persists via opening a new issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants